Click to See Complete Forum and Search --> : How to call the callback functions in unmanaged dll


newtoForum
March 29th, 2003, 02:32 AM
Hello,

I am using an unmanaged dll in my c#.net project.The dll uses some callbackfunctions which retrieve the status of the file stored.I am new to delegates.Can anyone provide me a solution for how should I use those callback functions in my project using delegates?

I am pasting the information of functions below:

-------------------------------------------------
typedef void (*GUI_UPDATE_PROC) ( GUIStatus )
Callback function to receive info about the VoiceRecorder status. Called everytime the status of the VoiceRecorder changes in a way that is important to know for the main application.
To prevent deadlocks, you must not call a VOICERECORDERLIB_API-function from this callback.

typedef void (*ERROR_PROC) ( const WCHAR* )
Callback function that is called if an error occurs. The WCHAR pointer must not be deleted or modified. It contains an error message which can be used to inform the user why the recorder stopped.
All errors are handled internally (resetting audio hardware, stopping etc.), this function is mainly intended to inform the user.
To prevent deadlocks, you must not call a VOICERECORDERLIB_API-function from this callback.

VOICERECORDERLIB_API void setCallbacks( GUI_UPDATE_PROC guiProc, ERROR_PROC errorProc )
This function sets the callbacks. Any of the parameters may be 0.
------------------------------------

GUIStatus is the structure defined in the dll.

I would be very much pleased on receipt of the help.

Thanks in advance

Regards,

petru66
April 17th, 2003, 11:18 AM
Have you already found the solution?

Let me see if I got it right: you want to connect somehow functions from C# to your callbacks, so that if an event happens in the unmanaged part, the functions in C# will be invoked. Is that right?