[GD-General] calling functions generically
Brought to you by:
vexxed72
From: Brett B. <res...@ga...> - 2004-02-14 02:16:52
|
I'm trying to write a generic function calling program such that I can = take a parameter list and the address of a function and build the call = dynamically at runtime on Windows, GameCube and PS2. I have an array of = input and output codes so I know the types and order of parameters to = use for the call, and what (if any) the return value is. I'm starting = with Windows first, and using CodeWarrior for all platforms. So far I got calling functions with parameters working by using inline = assembly to simply push the paramters to the stack and then do a call. = The trouble I'm having at the moment is the return values and how to get = them. I compiled a number test cases and displayed mixed C and assembly = and can't figure out the pattern of return values. 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? I have done lots of assembly = programming on other platforms, but this is my first look at Intel and = the 16/32 bit stuff combined with different modes is really confusing = for me. Thanks, Brett |