4 ms·
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?
by arriu 4y ago
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?
- aviramha 4y agoThanks! 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.
- IceWreck 4y agoIf you have the source code for both you should ideally use something like GRPC or another way to communicate. Or maybe cgo if you want to wet your hands into that. The approach in this blog works with compiled binaries.