• Advertisement
Sign in to follow this  

Function Pointer + DLL Syntax Help

This topic is 4740 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm wondering what the proper syntax is for the following: Base.h
extern BOOL (CALLBACK *Functor) (DWORD, DWORD);
code.cpp
BOOL (CALLBACK *Functor) (DWORD, DWORD);
If I were to do a __declspec (dllexport)..where would I put it? I seem to be putting it in the wrong spot? When I try to use the dll it says Functor is undefined thanks

Share this post


Link to post
Share on other sites
Advertisement

#define DLL_SYMBOL_EXPORT extern "C" __declspec(dllexport)

DLL_SYMBOL_EXPORT BOOL (CALLBACK *Functor) MyFunc(DWORD dwWord,DWORD dwWord2) {
}


That should work; although I haven't exactly worked with an API callback via DLLs yet; but that's where the __declspec goes. As far as I know you also need the extern "C" because C++ symbol tables turn out to be jumbled.

Share this post


Link to post
Share on other sites
So then I should just leave my declaration the same then? and export the actual definition?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement