Inclure du C dans Go lang

Voir :

https://go.dev/wiki/cgo

https://github.com/lxwagn/using-go-with-c-libraries

https://www.codingexplorations.com/blog/calling-c-functions-from-go-a-quick-guide

https://www.w3tutorials.net/go-tutorial/bridging-c-and-go-calling-c-libraries-from-go/

https://dev.to/metal3d/understand-how-to-use-c-libraries-in-go-with-cgo-3dbn

https://blog.mnguyen.fr/blog/2024-01-11-cgo-guide

https://karthikkaranth.me/blog/calling-c-code-from-go/

https://go-cookbook.com/snippets/other-topics/cgo

Voir aussi :

https://www.freecodecamp.org/news/golang-statically-and-dynamically-linked-go-binaries/

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