CGO: C++ Standard Library (darwin)

I am experimenting with mac’s deprecated reflective loading functionalities. I have a go program that invokes the go compiler to create binaries, but apple’s implementation of reflective loading is reliant on C++ for exception handling.

As I understand it, CGO is only for C and requires a C wrapper to use C++ code, but I cannot figure out of it is possible to just link standard libraries. I tried passing -lc++ and -lc++abi as linker flags along with -L /usr/lib, and some other things, but no luck.

What would be the simplest way to do this? Please feel free to ask for elaboration if necessary, I am new to programming, go, and still learning the C toolchain, and playing with software that is slightly above my paygrade, so I might have missed some important concepts.

The simplest method should be:
1.go->c++: go as a launcher
Export your c++ code to a c library, and then go uses cgo to call it.
2.c+±>go: c++ as a launcher
Export your go code to a c library through cgo, and then your c++ code calls it.
3. Find the corresponding go code implementation and learn

Okay, I figured out I was linking the libraries the wrong way. Instead of setting go env to CGO_LDFLAGS=‘-lc++ -lc++abi’ I was trying to set them in the command with the -ldflags flag. Now, I can successfully link the libs, but am still getting the error, which indicates an error with my software. Thank you

Hello!
I’m happy to see the issue is now solved. Thank you for updating us with the outcome.