Is it possible to create a Shared Library (.so) using Go?
UPDATED: created an "issue" for it.
Is it possible to create a Shared Library (.so) using Go?
UPDATED: created an "issue" for it.
This is possible now using -linkshared
flag
What you need to do is to first run this command:
go install -buildmode=shared -linkshared std
(Above code makes all common packages shareable!) then
go install -buildmode=shared -linkshared userownpackage
finally when compiling your code you need to run:
go build -linkshared yourprogram
What the above those is now it rather than statically linking everything only dynamically links them and you will end up with much smaller compiled files. Just to give you an idea my "hello.go" file with static linking is 2.3MB while the same code using dynamic linking is just 12KB!
Possible now! I built a .so file using Go and then imported into python quite easily! Here is an articles that I liked: http://www.darkcoding.net/software/building-shared-libraries-in-go-part-1/
Go Execution Modes describes Building Go Packages as a shared library:
"In this mode a Go package, or set of packages, may be built as a shared library. A Go program that imports one or more of those Go packages may be linked against this shared library. The shared library may be changed between the time the Go program is linked and the time it is run; the shared library that is available when the program starts is the one that will be used...
In the Go 1.5 release this is implemented for the linux-amd64 target only. When using gccgo it is implemented for any supported target."
Apparently, it now is possible, but only under very precise set of circumstances. More precisely, if you re writing for the Android platform.
The "goandroid" project on GitHub provides a set of patches that allows Go to build a shared library for specific use with the Android NDK. See https://github.com/eliasnaur/goandroid
I have a shared library(.so) that I preload before executing an application and I have a few global data structures in the shared library that the application uses. The application can create other ...
I have compiled a shared library on my Ubuntu 9.10 desktop. I want to send the shared lib to a co-developer who has a Red Hat Enterprise 5 box. Can he use my shared lib on his machine?
I ve got some .so libraries that I d like to combine into one shared library so that it doesn t depend on the original .so files anymore. The .so files have dependencies to each other. How can I do ...
Is it possible to create a Shared Library (.so) using Go? UPDATED: created an "issue" for it.
I have a shared library "libwiston.so". I am using this to create another shared library called "libAnimation.so", which will be used by another project. Now, the second library "libAnimation.so" can ...
I am running Linux, and I would like to be able to make parallel function calls into a shared library (.so) which is unfortunately not threadsafe (I am guessing it has global datastructures). For ...
This appears similar to an earlier post: ld cannot find an existing library But to the best of my knowledge, it s not exactly the same situation. The following command works: $g++ -I../../include/ -...
Has anyone found a fix for this? I read that it has something to do with new dylib format in Snow Leopard... (This is the lib I get back from MacPorts.) Thanks, rui