On Mon, 15 Apr 2024, Pali Rohár wrote:
These functions are exported on the DLL interface as plain "name". When we
call them, via a declaration marked as stdcall in C, it does produce a call
to the symbol "_name@size" instead of the regular "_name". This information
is not visible on the external DLL interface at all.
I was totally confused how it works. And now I figured out that import
libraries in mingw-w64 repository are generated with -k (--kill-at)
parameter for dlltool, which removes that @SIZE suffix from the symbol
name which is put into import table of the executable.
In past I generated import libraries from def files without -k argument
which seems that use 1:1 mapping between symbol in def file and in
import table.
Indeed, it's possible to use dlltool that way, but then it'd be pretty
messy to generate import libraries that work for these kinds of DLLs.
Gendef tries to look at the actual contents of the function, and uses
heuristics to guess whether the function uses stdcall or cdecl calling
convention. It's not foolproof though, as Liu Hao pointed out. objdump only
looks at the DLL export table, and I presume readpe does that as well.
So... if I understand it correctly then gendef tries to generate def
file which has to be processed by -k (--kill-at) argument of dlltool.
Yes, exactly.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public