vladimirvivien / go-cshared-examples

Calling Go Functions from Other Languages using C Shared Libraries
MIT License
885 stars 114 forks source link

-buildmode=c-shared not supported on windows/amd64 #6

Closed guppy57 closed 5 years ago

guppy57 commented 6 years ago

Im using go 1.9.3 and just tried to do this with this simple file :

package main

import "C"
import (
    "fmt"
)

//export add
func add(a, b int) int {
    var sum int = a + b
    fmt.Println("DONE")
    return sum
}

func main() {}

But kept getting the error above. Is there any way to fix this? Am I using the wrong command?

vladimirvivien commented 6 years ago

@guppythegod Apologies for the delayed response. You are not doing anything wrong. However, that flag (-buildmode=c-shared) is in deed not supported on Windows platform this point.

guppy57 commented 6 years ago

Thank you for replying

Zireael07 commented 6 years ago

Is this still the case? The relevant issue on golang's repo is now closed...

vladimirvivien commented 6 years ago

@Zireael07 I haven't checked on this in a while. Last release OSX support was added. It's possible windows was added for this upcoming release.

SommerEngineering commented 6 years ago

Since Go 1.10, it works also with Windows. Thus, this issue could be closed.

vladimirvivien commented 5 years ago

Thank you @SommerEngineering

famei commented 2 years ago

image image image I have the same problem with go 1.19, how should I solve it

famei commented 2 years ago

图片 图片 图片 我的 go 1.19 也有同样的问题,我应该怎么解决

image