Hi!
I have a need to create a Windows i386 DLL whose exported functions have
__stdcall calling convention - this is the requirement of the piece of
software which is to load and call this DLL; we cannot change the caller, and
have to adapt to its requirements.
The only approach I was able to find so far is to export the Go function under
a different name and have a separate C file with an adapter function declared
as __stdcall, which calls the target Go function. For instance, this approach
is detailed in [1].
The question: is there a more direct approach? Is it somehow possible to tell
cgo to generate the wrapper for the exported function as using __stdcall
calling convention (as such a wrapper is generated anyway)?
1.
https://github.com/golang/go/issues/32851#issuecomment-507017147