I am trying to pass a string from C # to C DLL. From what I read, .NET should do the conversion from string to char * for me, however I get "error CS1503: Argument" 1 ": cannot convert from" string "to" char * ". Can anyone advise me, where did I go wrong? Thanks.
C # code
[DllImport("Source.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] public static unsafe extern bool StreamReceiveInitialise(char* filepath); const string test = "test";
C dll
extern "C" { __declspec(dllexport) bool __cdecl StreamReceiveInitialise(char* filepath); }
source share