I am working on a C++ DLL with a C wrapper to be able to use it on different langages. For now, I am developing too a plugin in C# which call my DLL.
What I want is to pass as argument of my DLL a string (the path of a file) to be able to use it on my DLL.
C#
[DllImport(DllName, CallingConvention = DllCallingConvention)]
public static extern IntPtr AllocateHandle(string filename);
C wrapper
LPVOID SAMPLEDLL_API CALLCONV_API AllocateHandle(char* filename);
C++ class constructor
CustomData::CustomData(char* filename)
{
_filename = filename; // string _filename;
}
When I save _filename on a file (because I didn't find the way to debug using breakpoints on the DLL), I have something like ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ0à×
. I tried different solutions to convert a char* to a string but the result is still the same.
Thank you in advance for your help.