Hello
I have a exported function in a c++ DLL
// C++ DLL (Blarggg.dll)
extern "C"
{
USHORT ReadProperty( BYTE * messsage, USHORT length, BYTE * invokeID )
{
if( invokeID != NULL ) {
* invokeID = 10 ;
}
return 0;
}
}
That I would like to make it available to my C# application
// C# app
[DllImport("Blarggg.dll")]
public static extern System.UInt16 ReadProperty(
/* [OUT] */ System.Byte[] message,
/* [IN] */ System.UInt16 length,
/* [OUT] */ System.Byte[] invokeID );
private void DoIt()
{
System.Byte[] message = new System.Byte[2000];
System.Byte[] InvokeID = new System.Byte[1];
System.UInt16 ret = ReadProperty( message, 2000, InvokeID ); // Error
}
The problem is that I keep getting the following error message.
An unhanded exception of type 'System.NullReferenceException' occurred in Blarggg.dll Additional information: Object reference not set to an instance of an object.
I'm using VS2008 to build both the DLL and the C# application.
I'm not a C# programmer.
What am I doing wrong?