I have a simple console application:
extern "C" __declspec(dllimport) void foo();
int main()
{
foo();
}
which calls a function from DLL:
#include <stdio.h>
extern "C" __declspec(dllexport) void foo() {
printf("Hello from foo\n");
}
When I step into foo() call in Disassembly window (Debug -> Windows -> Disassembly)
I can see that instead of jumping directly to implementation of foo() in DLL it goes through intermediate dummy trampoline which is also located in DLL:
I haven't found any information about such trampoline in MSDN documentation. Perhaps anyone knows why it exists? I'm using the latest Visual Studio Community for compilation.
PS: Interestingly enough, the trampoline is present only in Debug build and disappears in Release. It's also not present when compiling code with Cygwin or Msys.

