I tried to write a Go shared library to make Apache or nginx modules.
What I would like to do is exporting a C struct variable, not a C function, from a Go shared library. #1. What version of Go are you using (go version)?
$ go version
go version go1.5beta2 linux/amd64
#2. What operating system and processor architecture are you using?
Ubuntu Linux trusty amd64
$ uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-55-generic #92-Ubuntu SMP Sun Jun 14 18:32:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
This is -buildmode=c-shared, so we are writing a library that can operate as a plugin for an existing program. That program doesn't know that it needs to call a function. It doesn't know that the plugin is written in Go. The program thinks that after it loads the library it can freely refer to variables defined by the plugin.