[Mono-dev] Options needed for imported Linux libraries.

Omar Siam simar at gmx.net
Thu Aug 12 10:49:54 EDT 2010


I compiled a C so lib on Linux to do ioctl calls and tried to use it
with DllImport but when I pass structures by ref or StringBuilder for
returning char* buffers to my library everything is behaving strange.
The StringBuilders returned do not contain anything or I have to create
a new StringBuilder for any call to unmanged code because they are stuck
to the first value returned. The structures contain nonsense data after
the second call into the library. What am I missing? How do I compile so
libs to be mono friendly?
I tried to Marshal my structure to an HGlobal IntPtr as the docs say
passing structures by ref to unmanaged code is unsupported (.NET
obviously supports this) but that didn't help. I use mono 2.6.7 on
openSUSE 11.3. Valgrind doesn't say anything about the functions I call
from mono when I run it using a C test program.



More information about the Mono-devel-list mailing list