problem with api call

Jul 28 2007 4:12 AM
hi im busy porting an old c++ project to c# (console) and having some issues with an API call the c++ api call is char p_DllVersion( char* Version); where the useage would be char version[256]; p_DllVersion(&version); printf("Version : %s",version); but im not getting this right in c# i tried [DllImport("c:\\p.dll")] public static extern char p_DllVersion(ref String Version); with useage String version; p_DllVersion(ref version); printf("Version : %s",version); but im getting error message Attempted to read or write protected memory. This is often an indication that other memory is corrupt. also tried to use out instead of ref and tried public static extern char p_DllVersion([Out] String Version); with no sucess ;( please help

Answers (2)