golang/go

cmd/cgo: warning: built-in function ‘free’ declared as non-function

Offen

#32.411 geöffnet am 03.06.2019

 (15 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Go (19.008 Forks)batch import
NeedsFixhelp wanted

Repository-Metriken

Stars
 (133.883 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

What did you do?

go run the following program that is using C.free as a value. (In actual code, it’s passed to a foo_set_free_fun(void (*)(void *)).) The warning is not emit when calling C.free(), nor is it when e.g. printing the address of C.getenv.

package main

// #include <stdlib.h>
import "C"
import "fmt"

func main() {
        fmt.Printf("%#v\n", C.free)
}

What did you expect to see?

What did you see instead?

Contributor Guide