Re: [go-nuts] Re: how embedded go in existing c/c++ program.

2017-04-18 Thread hui zhang
Thank you It did work . Build go code as a static c lib ,and go code also link another c lib. 在 2017年4月19日星期三 UTC+8上午9:04:37,Ian Lance Taylor写道: > > On Tue, Apr 18, 2017 at 6:01 PM, hui zhang > wrote: > > > > C functions have to be available when the Go package is built. > > yes, but

Re: [go-nuts] Re: how embedded go in existing c/c++ program.

2017-04-18 Thread Ian Lance Taylor
On Tue, Apr 18, 2017 at 6:01 PM, hui zhang wrote: > > C functions have to be available when the Go package is built. > yes, but static lib is kind of definition. > > //#cgo CFLAGS: -I > //#cgo CXXFLAGS="${CFLAGS}" > //#cgo LDFLAGS: -L -l > > will this above work ? if I want to build a go stati

Re: [go-nuts] Re: how embedded go in existing c/c++ program.

2017-04-18 Thread hui zhang
C functions have to be available when the Go package is built. yes, but static lib is kind of definition. //#cgo CFLAGS: -I //#cgo CXXFLAGS="${CFLAGS}" //#cgo LDFLAGS: -L -l will this above work ? if I want to build a go static lib? > how about go call c wrapper function , c wrapper fun

Re: [go-nuts] Re: how embedded go in existing c/c++ program.

2017-04-18 Thread Ian Lance Taylor
On Tue, Apr 18, 2017 at 1:37 AM, hui zhang wrote: > add a c wrapper around cfunc.h not help either. > > 在 2017年4月18日星期二 UTC+8下午4:36:26,hui zhang写道: >> >> 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

[go-nuts] Re: how embedded go in existing c/c++ program.

2017-04-18 Thread hui zhang
add a c wrapper around cfunc.h not help either. 在 2017年4月18日星期二 UTC+8下午4:36:26,hui zhang写道: > > 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) > > > ** > #include "libgofunc.h" > int main