txiki.js icon indicating copy to clipboard operation
txiki.js copied to clipboard

optionally build a shared library

Open brandonros opened this issue 4 years ago • 3 comments

I'm not very good at CMake so let me know how this can be better.

brandonros avatar Oct 09 '21 23:10 brandonros

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

brandonros avatar Oct 10 '21 00:10 brandonros

$ nm build/libtjs.dylib | grep TJS_GetJSContext
000000000000fb84 T _TJS_GetJSContext
$ nm build/libtjs.dylib | grep TJS_GetRuntime
000000000000fb8c T _TJS_GetRuntime

Not bad.

brandonros avatar Oct 10 '21 00:10 brandonros

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.

saghul avatar Oct 11 '21 06:10 saghul