Calling Go from C (or other languages)

Hey,

I found a few examples of Go being called from C, but I couldn’t find a resource that touches specifically on what starts the runtime and maybe a cursory explanation of the calling procedure (i.e. thread switching, stack switching, etc.)

Is there a comprehensive resource that explains what’s happening there?

Thanks,
Gilad

2 Likes

Hi, @gnaaman-dn, it is my understanding that to call Go from C, you need to already be within C from Go (i.e. Go → C → Go again). I’m not aware of any way to start from C, then bootstrap the runtime and call into Go.

1 Like