Hi
I am developing a wrapper for a C++ SDK DLL built for a video capture
card. After opening all channels on the card i call the function
StartVideoCaptu re(IntPtr channelHandle) what is supposed to happen after
that is that when the data stream is reday the DLL should raise an event
through a callback that i have registerd with the DLL. In that function
i can then access the data stream. The problem is just that the C++ Dll
uses void* pointers and i haven´t got the slightest clue on how to
Marshal that. I have the full source code of a C++ demo project and all
the DLL specifications. The function specs in the DLL lokks like this:
1.
typedef int (*STREAM_DIRECT _READ_CALLBACK) (ULONG channelNumber,v oid
*DataBuf,DWORD Length,int FrameType,void *context);
2.
DLLEXPORT_API int __stdcall
RegisterStreamR eadCallback(STR EAM_READ_CALLBA CK StreamReadCallb ack, void
*Context);
I have tried with something like this but with no luck.
public delegate short STREAM_DIRECT_R EAD_CALLBACK( uint
channelNumber,[MarshalAs(Unman agedType.IUnkno wn)]object DataBuf,uint
Length,int FrameType,[MarshalAs(Unman agedType.IUnkno wn)]object Context);
[DllImport("DsSd k.dll", CharSet=CharSet .Ansi)]
public static extern short
RegisterStreamD irectReadCallba ck(STREAM_DIREC T_READ_CALLBACK
StreamDirectRea dCallback,[MarshalAs(Unman agedType.IUnkno wn)]object
Context);
And then:
RegisterStreamD irectReadCallba ck(new
STREAM_DIRECT_R EAD_CALLBACK(th is.StreamDirect ReadCallback),
this.Handle);
But it keeps crashing hard every time i try to run it.
I have struggeld with this for a while now and desperatly need help..
/Henrik Pedersen
Sweden
*** Sent via Developersdex http://www.developersdex.com ***
Comment