Guest pai Posted April 29, 2005 Report Posted April 29, 2005 I write a DLL file in eVc++ extern "C" _declspec(dllexport) char* text2() { char text[20]; strcpy(text, "hello world"); return text; } And I want to use this DLL in my .NET c# [DllImport("cal.dll")] static extern string text2(); But I got Exception forSystem.NotSupportedException:NotSupportedException Does anyone here know this problem? Thanks
Guest filao Posted April 29, 2005 Report Posted April 29, 2005 Try using the StringBuilder class instead of a char array ... A quick Google brought this up: http://msdn.microsoft.com/library/default....gforstrings.asp Hope this helps
Guest pai Posted May 2, 2005 Report Posted May 2, 2005 (edited) after a few days, I get a result: use function like "int func(TCHAR* arg);" in C++ DLL. And in C# using Int32 func(StringBuilder arg); to use this function. Thanks filao Edited May 2, 2005 by pai
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now