How to debug C-shared library (written in Go) - it hangs on net call

Answer #1 100 %

Ok I solved this for my use case, you might be in a similar situation.

When you link your Go c-shared library to your C or C++ application, the Go runtime is loaded when you start the application (you can verify this, in func init() for example, it's called directly when you start your app). Then, if you fork a process and use the Go library, you will have unpredictable behaviour. Basically, you must load the Go shared library after fork and can't rely on it once you forked. Using dlopen and dlsym will allow you to control when the Go runtime get loaded.

You’ll also like:


© 2023 CodeForDev.com -