[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] virDomainInfo marshalling prolem


I think I got it. I think I have to marshal in this manner :

   public class DomainInfo
       private byte state;
       public UIntPtr maxMem;
       public UIntPtr memory;
       public ushort nrVirtCpu;
       public UIntPtr cpuTime;
       public DomainState State { get { return (DomainState)state; } }

And I also have to set the target of the LibvirtBindings project to x86. Why ? The compilation of libvirt under mingwin produce a 32bits binary, so I MUST marshal libvirt with a 32bits schema. That doesn't break compatibility with 64bits project using bindings, and this allow the usage of the attribute [MarshalAs(Unamanged.SysUint)]. This attribute specify the target schema for bindings at runtime. In this way, under 64bits systems, it takes ulong on 8 bytes, and on 4 bytes under 32bits.

This make the bindings work under Windows/mono(32bits, as the mono exxcutable is in 32bits, even if my system is 64bits), works also under Windows/.Net(64bits) and works under Ubuntu/Mono(64 bits).

Any suggestion ?



From: "Justin Clift" <jclift redhat com>
Sent: Saturday, October 30, 2010 1:39 AM
To: <arnaud champion devatom fr>
Cc: "Matthias Bolte" <matthias bolte googlemail com>; "Daniel P. Berrange" <berrange redhat com>; <libvir-list redhat com>
Subject: Re: [libvirt] virDomainInfo marshalling prolem

On 10/30/2010 01:48 AM, arnaud champion devatom fr wrote:
There is an unmanaged type to specify when marshaling this :
UnamanagedType.SysInt or UnmanagedType.SysUInt, which are 64b or 32bits
aware. But the problem under windows : libvirt is compiled thru mingwin
so the dll is in 32bits and even if windows is in 64bits, I have to make
bindings over 32bits (I'm not sure my english make things clear when I

Yeah, that's clear.  Using mingwin is causing the bindings to be 32-bit,
regardless of whether the Windows OS is 32-bit or 64-bit.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]