These two steps:
gcc -c main.c
gcc -o a.exe main.o MyThing.dll
Work great to make windows exe that can call methods inside MyThing.dll. Note gcc main.c without the -c would give error like:
undefined reference to MyThing_method
But when trying to get this same system working in a Golang program using cgo I get same undefined reference errors like I did with gcc without the -c. I've read:
https://github.com/golang/go/wiki/WindowsDLLs
And would love to try and use syscall.NewLazyDLL
but my issue is my foo.go file is calling C.SomeMethod() and inside that method it makes calls to the methods inside the DLL. So it seems I need a way to
go build -buildmode=c-share -o MyThing.dll
But I can't seem to get the right sequence. Am I right that if I can do this in the simple C program, there must be a way to do this from Golang?