On Sun, Sep 13, 2015 at 12:10 PM, Yutong Zhao <
prot...@gmail.com> wrote:
>
> I'm not sure who else here has been wrapping C++ code for Go, but some of
> the annoyances I've ran into are:
>
> -lack of shared_ptr typemaps for Go (both std:: and boost::)
This is hard to solve. We could use finalizers on the Go side but
it's hard to ensure that they only run when the pointer is no longer
being used.
> -std::vector doesn't map to go slices
> -std::map doesn't map to go map
What would these mean? Go slices and maps are reference types. C++
vector and map are not.
> -go doesn't support permit overloaded functions
Well, yes. It does permit SWIG wrapping C++ overloaded functions,
though.
> -not clear to me how to wrap virtual functions
This could mean a few different things, and I'm not sure what you
mean. Have you seen the code in misc/swig/callback in the Go
repository?
In general, Go and C++ are different languages. It's unrealistic to
safely and efficiently convert all constructs between them. I view
SWIG as doing the mechanical parts of calling between the languages.
You still have to write Go to provide an idiomatic Go interface.
Ian