Skip to content

Instantly share code, notes, and snippets.

@AlekSi
Last active December 10, 2015 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlekSi/4352551 to your computer and use it in GitHub Desktop.
Save AlekSi/4352551 to your computer and use it in GitHub Desktop.
struct my {
void (*f)();
};
package main
/*
#include "wrapper.h"
*/
import "C"
import (
"fmt"
)
//export goF
func goF() {
fmt.Printf("Hello from goF\n")
}
func main() {
m := C.generate_my()
fmt.Printf("%#v\n", m)
m.f()
}
#include "wrapper.h"
extern void goF();
struct my generate_my() {
struct my res = {goF};
return res;
}
#include "lib.h"
struct my generate_my();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment