I've figured out the problem.
After inspecting the assembly produced by mingw
, I found the C symbol names are being prefixed by an underscore. This happens on Windows, but not on Linux.
There is a gcc
option -fno-leading-underscore
, but this results in an undefined reference to WinMain
.
Simply adding leading underscores to the symbol names works.
Example: if my my symbol is named alien
in C, using gcc --defsym=_alien=0x500000
works fine.