This is really cool. Thanks for sharing.
Does anyone have any recommendations on how to do something like this but in reverse? Calling a go function from rust?
Does anyone have any recommendations on how to do something like this but in reverse? Calling a go function from rust?
Do you mean for an already compiled Go binary? if you can recompile you can use cgo.
If not the following requirements come to mind (there are more probably):
1. Allocate g and m if doesn’t exist in current process. 2. Switch to go stack before call
Btw there’s the cgocallback routine that manages C code that calls into go so that’s a good look to see what’s needed.
The approach in this blog works with compiled binaries.