go - Can I use c++ in cgo? -


Is it possible to combine some C ++ code into COO?

I tried to do this:

  package main / * #include & lt; Iostream & gt; Extern "C" Zero Test (const char * str) {std :: cout & lt; & Lt; Str; } * / / # Cgo CFLAGS: -exC ++ // # CAGO LDFALGS: -List ++ import "C" Fenc Main () {Seatest (c.c. string ("testing being !!!"}} < / Code>  

But I get these errors:

  Error: 'Four * cstirig (_GoString_)' can not appear in a continuous-removal error: ' Zero test (const char *) 'may not appear in a static-expression error:' four '(*) (_ GoString_)' 'long' '[-fpermissive] error invalid format Transmission: Illegal conversion from 'zero (*) (cons * *)' is used by 'go1.0.2 and minizew-y64 4.7.1'   

@Pahmeek provided a link to this feature in this bug tracker In return, a link was returned to the stack overflow, there was a good discussion, but was taking me:

  1. Link to the FAQ ():

    ... cgo The program provides the mechanism for a foreign function interface, SWIG extends this capability to the C ++ library to allow safe calling of C libraries from C code.

  2. Link.

Comments