Hi there,
I trying to enable domain events callbacks under a cross compiled (mingwin under fedora12
env) libvirt 0.7.4 (I haven't been able to compile more recent versions under mingwin)
dll. Here a little sample of code I'm trying to write :
#include "stdafx.h"
#include "windows.h"
#include "libvirt.h"
#include "virterror.h"
static int domain_event(virConnectPtr conn,
virDomainPtr dom,
int evt,
int detail,
void *opaque)
{
bool test = true;
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
virConnectPtr conn = virConnectOpen("qemu+tcp://192.168.220.198/session");
// Set Callback
int cbresult = virConnectDomainEventRegister(conn, domain_event, NULL, NULL);
// Lookup Domain
virDomainPtr dom = virDomainLookupByName(conn, "Test1");
// Start Domain
int startDom = virDomainCreate(dom);
if (startDom != 0)
{
virErrorPtr e = virGetLastError();
bool test = true;
}
// Wait
Sleep(60000);
// Stop Domain
int StopDom = virDomainDestroy(dom);
if (StopDom != 0)
{
virErrorPtr e = virGetLastError();
bool test = true;
}
return 0;
}
I'm able to connect to the host and I'm able to start the domain, but when I
enable callback with "virConnectDomainEventRegister", it fails, I have a message
"unmarshalling msg" coming from the "remoteDomainReadEvent" method of
remote_driver.c in libvirt.
I think about a problem near __stdcall or __cdecl calls or this kind of thing, but I'm
not sure.
Any clues ?
Best regards,
Arnaud Champion