4 ms·
Does anyone know an example of how lowlevel language interop could have been? Without incurring a huge perfomance loss? I imagine a cross language module conce
by eterps 4y ago
Does anyone know an example of how lowlevel language interop could have been? Without incurring a huge perfomance loss?
I imagine a cross language module concept with an accommodating module object file format would be ideal?
- adgjlsfhk1 4y agoall you need for an FFI spec is a calling convention and standard type names.
- eterps 4y agoHmm, did you assume that describing the calling convention and standard type 'names' should be in a separately provided plain text file like it is today?
- cryptonector 4y agoAnd sizes. And layouts.
- pencilguin 4y agoThe place where your language needs to interoperate with the outside world is in OS calls. The modern way to interact with an OS is to stick a request on a ring buffer and get back a request ID, and (eventually) check the response ring for that ID to show up. Like in io_uring. If your language is powerful enough, its OS library can encode that directly (without first marshalling arguments onto a stack that they must then be copied from) for minimal overhead. You might also have an FFI thing so you can call out to libcurl, libzstd and libsqlite. (Do any others matter?) Again, if your language is expressive enough, you can avoid building up an argument list the usual way that must then be reorganized for what the foreign library wants.