-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go: SWIG doesn't work on Windows #100
Comments
I'll try and see if I can do it in a platform independant way through |
Is there any progress on this? |
Not that I know of. You might want to check this https://github.com/steeve/libtorrent-go/blob/master/Makefile#L124 |
Based on the work of Wei Guangjing[1]. On Windows, dynamic binding of methods is not possible. So we use DllMain to do that. [1] https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyE [2] swig#100 Closes swig#100 Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
Based on the work of Wei Guangjing[1]. On Windows, dynamic binding of methods is not possible. So we use DllMain to do that. [1] https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyE [2] swig#100 Closes swig#100 Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
Based on the work of Wei Guangjing[1]. On Windows, dynamic binding of methods is not possible. So we use DllMain to do that. [1] https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyE [2] swig#100 Closes swig#100 Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
Based on the work of Wei Guangjing[1]. On Windows, dynamic binding of methods is not possible. So we use DllMain to do that. [1] https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyE [2] swig#100 Closes swig#100 Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
Based on the work of Wei Guangjing[1]. On Windows, dynamic binding of methods is not possible. So we use DllMain to do that. [1] https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyE [2] swig#100 Closes swig#100 Signed-off-by: Steeve Morin <steeve.morin@gmail.com>
Looks like #262 addressed the missing Looking at the current version of https://github.com/steeve/libtorrent-go/blob/master/Makefile I don't see any of the fixups to the SWIG generated code mentioned above. @steeve Does that mean this issue is no longer relevant (perhaps due to the switch to always using cgo and/or changes in more recent Go versions)? Or do the linked commits above in your fork need merging? |
golang/go#7281 indicates that this should have worked for more than 5 years (but after all the comments above apart from mine from a few weeks ago), so I'm going to close this now. If it doesn't seem fixed please give details and I'll be happy to reopen. |
Hey guys, sorry for the mistake when submitting.
I'm trying to build Go bindings for C++ lib, and while it does work on Linux, Mac, here are the steps I have to do to modify the
cxx
file to make it work on Windows, based in part on https://groups.google.com/forum/#!topic/golang-nuts/9L0U4Q7AtyEFirst of all, change all
struct swigargs
to be__attribute__((__packed__))
, according to https://code.google.com/p/go/source/browse/src/cmd/cgo/out.go#530 :For instance
However, on Win32,
long long int
is broken, suggested fix is, according to https://code.google.com/p/go/issues/detail?id=6541 :Also, Windows doesn't resolve symbols at compile time, so we need to properly set these symbols in a
DllMain
, and then have the file use them, see the dllmain file here: https://gist.github.com/steeve/7152742/raw/dllmain.cxxFinally, we need to fix the imports, I do it like so:
And here is a snippet of my Makefile to do that:
The text was updated successfully, but these errors were encountered: