[libvirt] Domains callbacks under mingwin

Dev.Atom arnaud.champion at devatom.fr
Tue Mar 9 11:08:56 UTC 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100309/2eea1a0d/attachment-0001.htm>


More information about the libvir-list mailing list