Generated import libraries (the ones used to link a program that will load a dll) AFAICS implements the various calls to the imported functions as assembly jmp
statments.
This indeed looks like a very optimal solution. It does not require pushing the arguments a second time, neither returning from a call.
I want to create my own import library, to add a couple of other functions in it. For this, I have to call the LoadLibrary()
and GetProcAddress()
functions to get the addresses of the functions in the dll. But then, I have to offer my own functions that will call the imported ones throught the function address. But this implies two calls, and pushing again the parameters on the stack. I'd like this double call to be optimized.
Does anyone know about a way to implement in C an import library that would do the same jmp
trick? (Or does the compiler optimizes the trail call?)