Outils pour utilisateurs

Outils du site


tech:inclure_du_c_dans_go_lang

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:inclure_du_c_dans_go_lang [2026/04/19 01:40] Jean-Baptistetech:inclure_du_c_dans_go_lang [2026/04/21 22:25] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon C Go Dev}}
 +
 +# Inclure du C dans Go lang
 +
 +Voir :
 +* [[Err Go lang et langage C]]
 +* 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
 +* https://blog.kchung.co/faster-python-with-go-shared-objects/
 +
 +
 +Voir aussi :
 +* https://www.freecodecamp.org/news/golang-statically-and-dynamically-linked-go-binaries/
 +
 +Inversement - Inclure du Go dans du C :
 +* https://github.com/vladimirvivien/go-cshared-examples
 +
 +
 +
 +~~~go
 +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
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki