txiki.js
txiki.js copied to clipboard
optionally build a shared library
I'm not very good at CMake so let me know how this can be better.
I'm not quite sure what the "on library load" function should be, let alone the named exports we need to now export. main() would need to be converted, and we'd need a way to access "should-be-globals" like TJSRuntime *qrt and JSContext *ctx
$ nm build/libtjs.dylib | grep TJS_GetJSContext
000000000000fb84 T _TJS_GetJSContext
$ nm build/libtjs.dylib | grep TJS_GetRuntime
000000000000fb8c T _TJS_GetRuntime
Not bad.
Good start! I think we bend some macro helper to export symbols on the library.
Alternatively, the binary itself could and be like a library. Node does this for example.