Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robbertvanginkel/05445fb48537f3b3b1ad8c51630685c4 to your computer and use it in GitHub Desktop.
Save robbertvanginkel/05445fb48537f3b3b1ad8c51630685c4 to your computer and use it in GitHub Desktop.
package main
// typedef int (*intFunc) ();
//
// int
// bridge_int_func(intFunc f)
// {
// return f();
// }
//
// int fortytwo()
// {
// return 42;
// }
import "C"
import "fmt"
func main() {
f := C.intFunc(C.fortytwo)
fmt.Println(int(C.bridge_int_func(f)))
// Output: 42
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment