[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 08:23 AM, Matthias Bolte wrote:
strdup() is nothing more than malloc() followed by strcpy();

See [1] for more details. When I understood Arnaud correctly then
passing the result of Marshal.StringToHGlobalAuto() directly as
cred.result didn't work, but passing the result from strdup() works.

Thanks for the reminder. I'm not very familiar with C# myself, but I do agree with the analysis that Windows memory management is not always straight-forward, since there is more than just the malloc() pool, and therefore strdup() is not necessarily a trivial operation since it determines which memory pool is in use. Sorry if my previous message came across harsher than intended (now that I've gone back and re-read it).

Marshal.StringToHGlobalAuto() + strdup() just works for now but is
ugly. Arnaud said  that he is working on a better approach for this
(custom marshaling), that doesn't require strdup().

Good luck with it, and thanks again to Arnaud for taking on the task of a new language binding.

--
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]