[libvirt] Using callback under Windows compiling of libvirt library
Dev.Atom
arnaud.champion at devatom.fr
Thu Mar 18 08:59:51 UTC 2010
Hi,
I have compiled LibVirt 0.7.4 under mingw, and I want to use it with domain callback. Here is a a code sample of my situation (I'm using visual studio) :
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");
if (virDomainIsActive(dom) == 1)
{
// Start Domain
int startDom = virDomainCreate(dom);
if (startDom != 0)
{
virErrorPtr e = virGetLastError();
bool test = true;
}
}
else
{
// Stop Domain
int StopDom = virDomainDestroy(dom);
if (StopDom != 0)
{
virErrorPtr e = virGetLastError();
bool test = true;
}
}
return 0;
}
This code works well when I did'nt use callbacks, but when I use it, it throw an error at the virDomainCreate or virDomainDestroy call. In the application windows (console) I have an "unmarshaling msg", I have study the case it comme from the call of "xdr_string" method in the "xdr_remote_nonull_string" method (remote_protocol.c).
I think, the xdr_string method is unable to marshall strings from the XDR* object to a char**.
I've tried with dynamic linking or static linking of libvirt lib. Have you any clue to have work callbacks ?
Best Regards,
Arnaud Champion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100318/ff605351/attachment-0001.htm>
More information about the libvir-list
mailing list