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

Re: [libvirt] libvirt library binary name for linux



On 10/19/2010 07:13 AM, arnaud champion devatom fr wrote:
?Well, as I have said I work on .Net/Mono bindings.

To make bindings, we use largely the marshaling methods of .Net/Mono. I
was working on bindings virConnectOpenAuth, so I have de marshal
virConnectCredential struct, these kind of thing. Matthias Bolte help me
a lot to make all the process thru callback working. And we have
discover that the virConnectCredential was reseted by the marshaling
process (in particular marshaling process free the result member of the
virConnectCredential, and in fact, for libvirt, it's the driver
responsability to free the result member). So Matthias suggest me to
bind strdup to .Net and use it to be sure that the result member is not
freed by marshaling. And it works.

strdup() is nothing more than malloc() followed by strcpy(); it is such a fundamental operation to copy strings into newly allocated memory that I'm surprised that you don't know how to do that natively in C# without having to bind in strdup() in the first place (even if you do have to do it in two phases of allocation and copying rather than as a single function call).

--
Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


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