Re: [GD-General] calling functions generically
Brought to you by:
vexxed72
From: Alen L. <ale...@cr...> - 2004-02-15 08:58:47
|
For a really robust and portable solution, perhaps you should use stubs? Just use a simple parser to preprocess a header file with function headers you want to call at runtime, and generate stub functions that take your argument lists and call the real ones. If you can afford that preprocess step (during compilation), you should have no problems handling any kind of calling conventions on any system, because the compiler actually does is all for you. A (very sketchy) description of this can be found in Game Programming Gems 3, I believe. We've been using such a system for some time now and it is very reliable. Just my 0.02$, Alen > > Sometimes the complier does a "pop ecx" on return and > > sometimes "mov dword ptr [ebp-0x8],eax" or a variant of that. > > Can someone help me to understand how to robustly handle > > this? |