• Advertisement
Sign in to follow this  
  • entries
    94
  • comments
    127
  • views
    83407

function pointer struct through a DLL

Sign in to follow this  

120 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