https://medium.com/@walkert/fun-building-shared-libraries-in-go-639500a6a669
https://www.darkcoding.net/software/building-shared-libraries-in-go-part-2/
https://karthikkaranth.me/blog/calling-c-code-from-go/
https://www.cockroachlabs.com/blog/the-cost-and-complexity-of-cgo/
https://golang.org/cmd/cgo/#hdr-Passing_pointers
https://blog.filippo.io/building-python-modules-with-go-1-5/
Build modes The 'go build' and 'go install' commands take a -buildmode argument which indicates which kind of object file is to be built. Currently supported values are:
-buildmode=archive Build the listed non-main packages into .a files. Packages named main are ignored.
-buildmode=c-archive Build the listed main package, plus all packages it imports, into a C archive file. The only callable symbols will be those functions exported using a cgo //export comment. Requires exactly one main package to be listed.
-buildmode=c-shared Build the listed main package, plus all packages it imports, into a C shared library. The only callable symbols will be those functions exported using a cgo //export comment. Requires exactly one main package to be listed.
-buildmode=default Listed main packages are built into executables and listed non-main packages are built into .a files (the default behavior).
-buildmode=shared Combine all the listed non-main packages into a single shared library that will be used when building with the -linkshared option. Packages named main are ignored.
-buildmode=exe Build the listed main packages and everything they import into executables. Packages not named main are ignored.
-buildmode=pie Build the listed main packages and everything they import into position independent executables (PIE). Packages not named main are ignored.
-buildmode=plugin Build the listed main packages, plus all packages that they import, into a Go plugin. Packages not named main are ignored. On AIX, when linking a C program that uses a Go archiv
Who gens the .h file ?
prokash@prokash-PC /cygdrive/c/Users/prokash/mysrc/C++go
$ ls
bidder_module.go main.cpp run.sh wincmds
prokash@prokash-PC /cygdrive/c/Users/prokash/mysrc/C++go
$ source ./run.sh
runtime/cgo
gcc_libinit_windows.c: In function ‘x_cgo_sys_thread_create’:
gcc_libinit_windows.c:58:19: error: implicit declaration of function ‘_beginthre
ad’; did you mean ‘OpenThread’? [-Werror=implicit-function-declaration]
58 | thandle = _beginthread(func, 0, arg);
| ^~~~~~~~~~~~
| OpenThread
cc1: all warnings being treated as errors
main.cpp:3:10: fatal error: bidder_module.h: No such file or directory
3 | #include "bidder_module.h"
| ^~~~~~~~~~~~~~~~~
compilation terminated.