Question

My ultimate goal is to successfully link to a number of DLLs (opengl32.dll glfw.dll and glu32.dll) from a Go package -- but trying to link to the go-glfw package gave me "not defined" errors.

So I decided to get a very simple cgo dynamic/shared library linking to work, from the simple unmodified example in %GOROOT%\misc\cgo\life. But just invoking the command go build -o life main.go fails with essentially the same linker error, namely:

go-build374967034/_/C_/Go/misc/cgo/life.a(c-life.o)(.text): _assert: not defined

"not defined"... just exactly the same error I had when trying to link glfw as per above.

This is a fresh untampered-with install of Go 1.0.1 freshly downloaded this morning, on a vanilla, fairly recent Win7 64-bit installation. What could possibly go wrong? I know... Windows. Would love to hear any ideas... seems like DLL linking with CGO is a no-brainer and simple to do from what I read around the net. Yet even the simplest of examples fails for me.

Was it helpful?

Solution

I've think this particular bug has been discussed here: http://code.google.com/p/go/issues/detail?id=3261 but I'm not sure if it can be applied to your case. In the end from what I've read they proposed a patching but not really tried 'cause I'm waiting 1.1 release (hoping they'll fix the runtime infamous memory leak ;) )

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top