calling functions generically
"Brett Bibby" <[email protected]>
| Newsgroups | gmane.games.devel.general |
|---|---|
| Organization | GameBrains |
| Message-ID | <[email protected]> |
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 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=click _______________________________________________ Gamedevlists-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_idU7