mixing calling conventions question
- From: "Gabriel" gabrielcorneanuATyahoo.com
- Date: 31 Oct 2005 01:01:40 -0700
I have the following situation (simplified): a library (dll) I need (for data acquisition) comes in 2 versions. The main difference is the calling conventions: one is using stdcall and one is using cdecl.
Now I have an import unit using dynamic loading, which is able to init the functions from either of the dlls. Of course I use some "ifdef" to mark the function variables with the proper calling convention. But this means I have to decide at compile time.
I would like to be able to use a program with any of the dlls. Is there a way to do this? One solution is to duplicate the whole import unit for each situation and to make wrapper calls, but that's a lot new code.
I was thinking of placing all functions in a table, redirect the calls to a small asm code that would unload the stack parameters in case of cdecl version. But how can I know the number of parameters??
I am out of ideas, but I don't rush in implementing the wrapper calls yet. Maybe someone has a better idea.
Thanks,
Gabriel
.
- Follow-Ups:
- Re: mixing calling conventions question
- From: Avatar Zondertau
- Re: mixing calling conventions question
- From: Will DeWitt Jr.
- Re: mixing calling conventions question
- Prev by Date: Re: FastMM4 bug?
- Next by Date: REP RET
- Previous by thread: FastMM4 bug?
- Next by thread: Re: mixing calling conventions question
- Index(es):