Re:The Witchcraft Compiler Collection
by Nullabillity on Saturday August 13, 2016 @06:43PM
(#12283439)
You can build native C-compatible libraries from Rust, see https://doc.rust-lang.org/book/ffi.html#calling-rust-code-fr...
There is indeed a much easier way: Just create `.so` libraries (with a C interface, for example) from go or rust, as they compile to native code anyway.
I wouldn't use wcc for that ever, only for reverse engineering and similar things.
Nowadays Go compilers also support creating libraries to be consumed by C, just not on all OSes as this is WIP.
https://golang.org/cmd/go/#hdr-Description_of_build_modes
go build -buildmode=c-archive
or go build -buildmode=c-shared
Is there a better way to do this? Right now the alternative I'm thinking about is creating opening sockets from the Rust and GO side and talking to them via TCP.
But the end result I want is a single binary for the target platform and no install complications other than putting the binary on a stock unix machine.
I'm sure there's a better way.