-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: missing entry in c-shared .dll #42409
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
Comments
As you are on |
Calling the DLL from an external program does not work, I get a While rundll32 does not correctly run the function, it does seem to detect the missing entry regardless. I aIso first tried with Dependency Walker which does not find anything either: I did not try 32 bit, my toolchain seems to be broken somewhere. |
This seems to have been fixed on the latest beta.
Using the previous minimal example: package main
import "C"
import "fmt"
import "github.com/karalabe/hid"
//export HelloWorld
func HelloWorld() *C.char {
var err error
fmt.Print("Hello world!")
devices := hid.Enumerate(0, 0)
for _ = range devices {
fmt.Printf("Found a device\n")
}
if nil != err {
return C.CString(err.Error())
} else {
return C.CString("Hello World!")
}
}
func main() {
HelloWorld()
} Here is the output of Dep. Walker: The entry for Running |
This might be caused by When binutils linker sees a Go will start annotating exported functions with |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am trying to compile my code to a shared library (specifically a dll on Windows; there is no issue on Linux).
Here is what I found to be a minimally reproducible example.
I then compile the shared library using the following commands:
I get the following files:
main.dll
main.h
Here is the header file:
The function is declared in the header, as expected. However,
I get an ErrorBox:

Expectations / things that would show it works
I would expect this error box not to show up basically. If I remove the dependency to the HID library it works, the call is made. I believe this might be a bug with Go and not the library because it works on Linux and I get an otherwise valid header file, and basically no relevant warning while compiling.
I would have expected that if no entry was to be created, I would get a compilation error / warning / advisory. I do get a warning while compiling but it's from the included library. The same warning occurs while building the app (which works). I am including it here just in case, but I do not believe it has anything to do with the issue; it's a fairly standard warning when using
strncpy
The text was updated successfully, but these errors were encountered: