mixing calling conventions question




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
.