3 ms·
> When linking, I find the libraries on disk, load them, call a function in each dynamic library that returns a list of procedures that can be used when linking
by bobajeff 3y ago
> When linking, I find the libraries on disk, load them, call a function in each dynamic library that returns a list of procedures that can be used when linking. This external linking enables Onyx to use any native C library, from Raylib and OpenGL, to PostgresQL and OpenSSL.
This is really cool. I wonder if there is any overhead using native libraries from wasm like this. My intuition says it does similar to node-ffi and JNI but I hope it's not as bad.
- brendanfh 3y agoI haven't directly measured any throughput or latency numbers. I know it is relatively fast, but I know it is not as seamless as I would like. Currently, for WASM to call any imported function, its arguments have to be formatted in a particular way that is specified by the wasm-c-api. Then it can invoke the imported function. Only after that can the arguments be translated back into the native calling convention in order to call the real native function. I don't know how that compares to node-ffi and JNI, but I imagine its not as slow. I have a piece of documentation I need to write that will explain how calling native libraries works from Onyx, so that should be able to go into more detail.