Nicholas, GREAT to have helping people like you around! (Kudzu, also
thanks for responding).
I've now made a 'giant' leap in my C# code (I'm new to it!!): the
callback is now invoked properly and data read from the file is also put
correctly into the specified buffer.
I'm still struggling though ...: the code-line calling the unmanaged
stuff ultimately ends up in an exception error:
"System.NullReferenceException: Object reference not set to an instance
of an object". Now this is heavy stuff for me ....!
I'm not sure you are still willing to help me, but in case of a yes, I
attached the relevant code hereafter.
My C#-app is using a third party legacy-DLL, one of the functions is a
ordinary OpenFile command:
------------------------------------------------------------int MC_Open_File (
int AppID,
int FileID,
void* info,
int (*YourCallbackFunction)
[DllImport("mc3adv.dll")]
public static extern int MC_Open_File(
int AppID,
int FileID,
CBinfo cbi,
MediaToFileDelegate MediaFunction);
typedef struct CALLBACKINFO
{
FILE* stream;
int messageID;
unsigned char buffer[8*1024];
} CBinfo;
[StructLayout(LayoutKind.Sequential)]
public class CBinfo
{
public int stream;
public int messageID;
public byte[] buffer;
}
CBinfo cbi = new CBinfo();
cbi.buffer = new byte[8*1024];
try
{
mcStatus=MC_Open_File(
nAppID,
nFileID,
cbi,
new MediaFunctionDelegate(MediaFunction));
}time.