T
Ted Sung
Hi,
I'm trying to call a C function from a DLL. The C function is
declared as
char * function( const char * )
I'm declaring it in C# as follows:
[DllImport(@"d:\mywork\csharp\testsubs\cmosub32.dll")]
public static extern string icmo_version_chk(
[MarshalAs(UnmanagedType.LPStr)]
string version );
and using it as follows:
string sTestVersion = "3.0f_p2";
string sVersion = icmo_version_chk( sTestVersion );
I get an exception: System.NullReferenceException ... Object reference
could not set to an instance of an object.
What am I doing wrong? Is it the string icmo_version_chk? If so,
what should I use.
Thanks,
Ted
I'm trying to call a C function from a DLL. The C function is
declared as
char * function( const char * )
I'm declaring it in C# as follows:
[DllImport(@"d:\mywork\csharp\testsubs\cmosub32.dll")]
public static extern string icmo_version_chk(
[MarshalAs(UnmanagedType.LPStr)]
string version );
and using it as follows:
string sTestVersion = "3.0f_p2";
string sVersion = icmo_version_chk( sTestVersion );
I get an exception: System.NullReferenceException ... Object reference
could not set to an instance of an object.
What am I doing wrong? Is it the string icmo_version_chk? If so,
what should I use.
Thanks,
Ted