Skip to content
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

cmd/go: go build -buildmode=c-shared -o Not Supported on Windows amd64 #23582

Closed
guppy57 opened this issue Jan 28, 2018 · 1 comment
Closed

Comments

@guppy57
Copy link

guppy57 commented Jan 28, 2018

VERSION : 1.9.3

This problem does reproduce with the latest release
.
OS AND HARDWARE : Windows 10 AMD64

I tried building my sum.go file using go build -buildmode=c-shared -o sum.so sum.go.
Instead of it completing, I got this error -buildmode=c-shared not supported on windows/amd64

This is the 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() {}

I expected the command to go through and create a sum.so and a sum.h file

Instead I got --> sum.go file using go build -buildmode=c-shared -o sum.so sum.go.

Im doing this so I can import my golang functions into python, is there a way to fix this? Am I using the wrong command, or the wrong file configurations? Thank you.

@ianlancetaylor
Copy link
Contributor

Support for the c-shared build mode on Windows is new in the upcoming Go 1.10 release. I encourage you to try to 1.10 release candidate that was announced a couple of days ago.

Closing because this should work in 1.10 and is not expected to work in 1.9.

@mikioh mikioh changed the title go build -buildmode=c-shared -o Not Supported on Windows amd64 cmd/go: go build -buildmode=c-shared -o Not Supported on Windows amd64 Jan 30, 2018
@golang golang locked and limited conversation to collaborators Jan 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants