Jump to content
  • Advertisement
Sign in to follow this  
kag1

Function Pointer + DLL Syntax Help

This topic is 4920 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!