I want to embedded go code in c/c++ program.
my approach as below,  however go code can not be compiled
C main()  -->  go func -->  c func(in static lib)


*<main.c>*
#include "libgofunc.h"
int main() {
       Gofunc();
}

*<gofunc.go>*     CGO_ENABLED=1  go build -buildmode=c-archive -o 
libgofunc.a  -->  error  

Undefined symbols for architecture x86_64: "_cfunc"
package main

//#inclue "cfunc.h"
import "C"
//export Gofunc
func Gofunc() {
        C.cfunc() //cfunc is in a static lib
}func main() {} // Required but ignored

*<cfunc.h , cfunc.a>*
extern void cfunc();

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to