Hacker News new | ask | show | jobs
by inglor 1224 days ago
Why would rust even have this problem? Rust has native "extern "C"" blocks and good FFI.

The issue in Go is that goroutines run on small stack and C code has no way to know of that or increase the stack size - so Go's C calling facility (cgo) has to go through a thread and a proper stack.

There are some wild assembly hacks to go around it ^^

2 comments

This project isn't really about calling C functions, Go already supports that after all (CGO). Rust does suffer the same problem, which is that cross-compilation when using C code is a bit of a nightmare.

purego solves this by using dlopen and friends.

My understanding is Rust solves this through libloading (same approach effectively) and more heavy-handed approaches like cross-rs which distribute full C/C++ build toolchains for each target (in Docker images or something?)

I meant calling Rust from Go.
Oh then sure, I don't see why you couldn't use it with something like https://github.com/mediremi/rust-plus-golang