I have a C# project that uses an dll function, via import, where the dll is created from an unmanaged c++ project.
[DllImport("sample.dll")]
int readPath(string somePath);
On the C++ side, the function definition is:
int readPath(wchar_t* somePath);
When I try to call the function from C# side and pass in Application.StartupPath... The following DOES NOT WORK!
readPath(Application.StartupPath);
On the C++ side I end up getting only the first CHAR of the path.
But by calling ToString(), I get the entire path string just fine.
readPath(Application.StartupPath.ToString());
Can someone explain why that's the case?
Thanks!