3 ms·
I'd wager a large amount of that is handling symbol lookup for calling through the FFI.
by hackcasual 10y ago
I'd wager a large amount of that is handling symbol lookup for calling through the FFI.
- nneonneo 10y agoI quote the mJS readme from the repo: > In order to make FFI work, mJS must be able to get the address of a C function by its name. On POSIX systems, dlsym() API can do that. On Windows, GetProcAddress(). On embedded systems, a system resolver should be either manually written, or be implemented with some aid from a firmware linker script. So I guess they don't provide any implementation for their FFI linking on embedded platforms? It's not clear if the 25k size figure includes any dlsym support, but if it requires instrumenting your firmware image on-disk then the size costs could balloon significantly.
- drozd 10y agoCurrently we use mJS in our Mongoose OS firmware framework. There, a symbol resolver is generated automatically from the configuration file which tells which symbols you'd like to use. https://github.com/cesanta/mongoose-os/blob/master/fw/examples/mjs_hello/mos.yml https://github.com/cesanta/mongoose-os/blob/master/fw/exampl...