2

I’m working on a project that makes usage of some C++ libraries, this libraries use namespaces like:

namespace ns {
    void hello();
}

All compiles, and I can use the functions out of namespaces, but I can’t find docu about how to work with namespaces in order to access to this method from Go. My first idea was to use a small wrapper using the cgo comments like: package stuff

// #import <some_libs.h>
/*
void hello() {
    ns::hello();
}
*/
import “C”

But this fails with an:

error: expected expression before ‘:'

another option is to prepare the wrapper out of the .go file, but this is going to make a bit more complicated the installation, etc of the libraries. What is the best approach?, can I just call to this method using the C lib? something like: C.ns.hello()??

Thanks!,

0 Answers0