[MonoDevelop] communicating a C++ library and C#, completed

Leonel Florin Selles leonel.florin at cfg.jovenclub.cu
Mon Dec 12 21:52:36 EST 2011


Hi list, in a few day ago I make a question where need it to create a C++
DLL to be used in C#, but monodevelop do not create c++ DLL, it create
*.so, well, I find the solution here

http://www.mono-project.com/Interop_with_Native_Libraries

is the same as using C++ DLL from Windows, but with using .so library.

A point to have in mind is the Marshaling of the managed C# data type to
unmanaged C++ data type.

for that we need to use a intPtr C# pointer and the data type in C# that
we are using to marshaling for example

C#:
string name = "Victor";
intPtr namePtr = Mono.Unix.UnixMarshal.StringToHeap (name);

this is the equivalent for the c# string data type to char [], or char *
in C++.

greetings.




____________________________________________
Algunos suelen hayar su destino en el sendero que toman para evitarlo.
____________________________________________
Tu mente es como el agua, cuando esta agitada se vuelve dificir ver, pero
si dejas que se calme, la respuesta se vuelve clara.
____________________________________________
El ayer es historia, el mañana es un misterio, pero el hoy es un obcequio,
por eso se llama presente.



More information about the Monodevelop-list mailing list