Re:Sorry state of dynamic libraries on Linux
by npsimons on Monday September 17, 2012 @11:01AM
(#4532854)
As for memory allocation, it's not really a good idea to allocate memory in a library and free it in another, is it?
Ah, I guess I'll have to stop using strdup() then.
Re:Sorry state of dynamic libraries on Linux
by shin_lao on Monday September 17, 2012 @11:10AM
(#4532895)
strdup(), part of the libc, allocates memory with a function from the libc (malloc), therefore you are allocating and freeing memory with functions within the same library.
However, yes, for security reasons strdup should be avoided.
The second problem has got nothing to do with DLLs and everything to do with the fact that there is no C++ ABI.
As for memory allocation, it's not really a good idea to allocate memory in a library and free it in another, is it?