, , ,

Inclure du C dans Go lang

Voir :

Voir aussi :

Inversement - Inclure du Go dans du C :

package main
 
// #include <stdio.h>
// #include <stdlib.h>
//
// static void myprint(char* s) {
//   printf("%s\n", s);
// }
import "C"
import "unsafe"
 
func main() {
	cs := C.CString("Hello from stdio")
	C.myprint(cs)
	C.free(unsafe.Pointer(cs))
}

Source : https://pkg.go.dev/cmd/cgo

FIXME