Callbacks and Managed Code

G

Guest

I am trying to wrap a very old dll from Epson with a Managed Dll.
Their declaration for the callback is this:

typedef int (WINAPI* DLL_BiSetStatusBackFunction)(int, int (CALLBACK EXPORT
*pStatusCB)(DWORD dwStatus));

but when I compile it, I get the following errors:

Error 1 error C2143: syntax error : missing ')' before
'*' c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h 48
Error 2 error C2143: syntax error : missing ',' before
'*' c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h 48
Warning 3 warning C4229: anachronism used : modifiers on data are
ignored c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h 48
Error 4 error C2059: syntax error :
')' c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h 48
Error 5 error C2091: function returns
function c:\lennys\alvordtech\posprinter\posprinter\POSPrinter.h 48

Obviously, the syntax has changed.
All of the non-callback functions are declared as follows:

typedef int (WINAPI* DLL_BiOpenMonPrinter)(int, LPSTR);
typedef int (WINAPI* DLL_BiSetMonInterval)(int, WORD, WORD);

These work fine when I use LoadLibrary and GetProcAddress.
Does anyone know the proper syntax for the callback?

Steve
Microsoft Certified Partner
 
D

DrZogg

Why would you want to use a callback?.. are you callingback into
unmanaged code?

Try using Delegates for managed callbacks

Christopher
 
G

Guest

Epson's Dll has a callback function that will notify my managed dll of a
status change to the printer. My previous post stated the declaration for
the callback from their dll. That is what is giving me the error.
I want to get the callback into my dll and then send notifications to the
application that is using my managed dll.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top