3 ms·
Could this be used to combine the output of projects written in incompatible languages? EG: say I have a rust program and a go program, both are open source, b
by 20yrs_no_equity 10y ago
Could this be used to combine the output of projects written in incompatible languages? EG: say I have a rust program and a go program, both are open source, but I want to call them from a swift program. Could I compile the rust and go programs into ELFs then use WCC to break them out into "libraries" and then call them from swift?
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.
- csl 10y agoThere 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.
- Nullabillity 10y agoYou can build native C-compatible libraries from Rust, see https://doc.rust-lang.org/book/ffi.html#calling-rust-code-from-c https://doc.rust-lang.org/book/ffi.html#calling-rust-code-fr...
- pjmlp 10y agoNowadays 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 https://golang.org/cmd/go/#hdr-Description_of_build_modes go build -buildmode=c-archive or go build -buildmode=c-shared