"Papa.Coen" <pa*******@gmail.comwrote in message
news:11********************@g4g2000hsf.googlegroup s.com...
Let me tell a little bit more: the starting point is calling a C++
function from dotNET/C#
callMe(std::string* input, std::string* output, str:string* error)
When I tried using StringBuffer for the input (output & error seem to
work just fine as out IntPtr parameters) I got the above error. I've
tried a 'million' different ways to pass the input parameter to the C+
+ dll, but I just can't get it working!
P/invoke can't handle C++ objects. Not at all, don't even try.
C++/CLI interop can though, so if you write the bit of code calling the C++
functions in a C++/CLI ref class you can convert the .NET String into a C++
std::string and make the call. The C++/CLI ref class is a real .NET type
which can be used from C#.
Another concern is that you seem to have a C++ DLL with objects as
parameters of exported functions. This is badly broken, since different
compilers provide different definitions of std::string. Do you have the
source code of the C++ function? If so, don't make a separate DLL for it,
compile it and the C++/CLI ref class together into a "mixed-mode" assembly.