draffensperger / go-interlang

Examples of calls between Go and C/C++ (and how to call a Go shared object from Node/Ruby/Python/Java)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we call Go From C++ using SWIG

DinoStray opened this issue · comments

I know we can call C++ from Go using SWIG.
But can we call Go From C++ using SWIG?

So for calling Go from C++, I don't think you need SWIG because Go's functions follow normal C calling conventions, which C++ can also use, see this example here:

long total = Add(30, 12);

What would be your motivation for using SWIG for calling from C++ to Go?