How to declare callback 
Author Message
 How to declare callback

Hi,

I need to define/declare a callback function in VC. The call back
function mechanism I used on SGI IRIX doesn't link on VC. It is simply :

typedef void (*TALoggerCbFunc)();

class taLoggable {
    // lots of other stuff

    void regLoggerCb( TALoggerCbFunc func );
    static TALoggerCbFunc loggerCallback ;

Quote:
}

In the MFC code :

void myFunc (){

Quote:
}

anInstance->regLoggerCb( myFunc )

I get this error message

WorkerThread.obj : error LNK2001: unresolved external symbol "public:
void __thiscall taLoggable::regLoggerCb(void (__cdecl*)(void))"

Debug/TestBed.exe : fatal error LNK1120: 1 unresolved externals

Any ideas ?

devrim.



Mon, 23 Sep 2002 03:00:00 GMT  
 How to declare callback
Greets,

    For your typedef, add the 'void' between the final parenthesis as well
as the function definition/declaration for the callback.

Regards,

Joe


Quote:
> Hi,

> I need to define/declare a callback function in VC. The call back
> function mechanism I used on SGI IRIX doesn't link on VC. It is simply :

> typedef void (*TALoggerCbFunc)();

> class taLoggable {
>     // lots of other stuff

>     void regLoggerCb( TALoggerCbFunc func );
>     static TALoggerCbFunc loggerCallback ;
> }

> In the MFC code :

> void myFunc (){
> }

> anInstance->regLoggerCb( myFunc )

> I get this error message

> WorkerThread.obj : error LNK2001: unresolved external symbol "public:
> void __thiscall taLoggable::regLoggerCb(void (__cdecl*)(void))"

> Debug/TestBed.exe : fatal error LNK1120: 1 unresolved externals

> Any ideas ?

> devrim.



Mon, 23 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to declare callback

2. how do i declare callback functions

3. How to declare callback

4. Howto: declare a C function that registers a callback in IDL

5. How to declare a callback function for use by a DLL

6. Declaring static document class with callbacks

7. Declaring static document class with callbacks

8. CALLBACK, CALLBACK, CALLBACK?

9. How to declare a class member as a callback?

10. Why can't I declare a variable with the same name as declared in a for loop

11. How do you declare optiona method parameters in C#

12. Declaring Constants

 

 
Powered by phpBB® Forum Software