[libvirt] [java] [PATCH] GetNodeCpuStat binding

Claudio Bley cbley at av-test.de
Tue Apr 15 09:04:59 UTC 2014


At Tue, 15 Apr 2014 10:36:02 +0200,
Pasquale Dir wrote:
> 
> Working for the other corrections but I disegree with these ones:
> 
> 1. This is an "unsigned long long" in C, so it must be a long, not
> NativeLong here.
> 2. flags is an "unsigned int" in C, so it
> must be an "int" in Java

That is a hard requirement when wrapping native libraries with JNA, it
is an error to do what you suggest.

See http://twall.github.io/jna/4.1.0/overview-summary.html#marshalling

> As in java types are signed I'd avoid to allocate the exact same
> memory, on the contrary I would allocate more space so that an high
> positive value for an unsigned C type would stay an high positive
> value in java (who would make it a negative value if space is not
> enough).

Impossible, you have to adhere to libvirt's ABI.

Regards,
Claudio




More information about the libvir-list mailing list