Jump to content
Sign in to follow this  
  • entries
    94
  • comments
    127
  • views
    83577

function pointer struct through a DLL

Sign in to follow this  
Seriema

129 views

yeah, I need to learn how to do that :P

Heard that's how they do it in the Quake engines. And I understand why. I've just written my second proxy class for accessing functions in a DLL. Redudant work. Should be able to do some template magic by using Loki. But somehow I decided not to use any external libraries for ThumbView.

That's pretty dumb. I should learn to use libraries like Boost and Loki. Especially Boost::Lambda.

Well I might be rewriting ShellExtension using the new ATL later. And then I might start switching working code with learning code using 3rd party libraries.

No wait, that's even dumber.
Sign in to follow this  


3 Comments


Recommended Comments

I did that in one of my engine experiments once, turned out pretty successful.


typedef bool (*pfnEngineFunction)(int pTest);

struct sEngineExports
{
pfnEngineFunction superFunc;
};


bool MySuperFunction( int pTest ) { /// OMG!!! return true; }

// In game init
sEngineExports export;
export.superFunc = &MySuperFunc;

// Do dll loading here

// Pass struct to interface
dll->InitEnginePlugin( &export );

///////// In dll
void InitEnginePlugin( sEngineExports *engine )
{
// Call engine MySuperFunction via function pointer
engine->superFunc();
}




Or something like that anyhow...

Share this comment


Link to comment
thanx evolutional =D

I'm gonna check that out someday, since my hardcoded stuff seems to work. And muer's C++ library has a DLLProxy template thingie that looks kinda interesting.

To another time!

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!