I've read <https://emscripten.org/docs/compiling/Dynamic-Linking.html>, but
I'm used to native code linking, and I have questions.

I'm porting a large library written in C and C++ to Emscripten, along with
its test harness. I can build them as a statically linked program, putting
it into one big .js file via SINGLE_FILE, and it runs. There are various
problems to solve, but it runs in Node.js and passes quite a few tests.

I am not *producing* a web application. The library is intended to be used
in web applications, written by organisations that license this
(commercial, closed-source) library. Up to now, I've been assuming that I
need to ship the library in archive library form, because when this project
was first scoped, about two years ago, modules couldn't call modules
directly, only via JavaScript. Creating a JavaScript binding for this
library would be a huge task, and I'm not attempting it at present.

Today, I checked the dynamic linking page, and it looks as if modules can
now call modules directly, without going through JavaScript. First of all,
is that correct?

If that is true, I clearly need to build my library as a Side Module and my
test harness as a Main Module, linked against the Side Module, for
load-time dynamic linking. The page says that Side Modules can't be linked
against system libraries, but presumably they can *use* system libraries?
It's just that the Main Module must be linked against all system libraries
that any Side Modules use? My Side Module definitely requires the C and C++
run-time libraries.

If that's all correct, how do I tell my Main Module where to find the Side
Module when I run the program in Node.js? Is there an equivalent of
$LD_LIBRARY_PATH? Or does it just have to be in the same directory?

How does a web application get access to the Side Module? I'm not doing
this, but I will inevitably be asked about it.

Thanks in advance,

John Dallman

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAH1xqgnnVfxnBydT3L8cR%2B%2Breigy%3D6aTRThWRFLCvy%3D75wVfeQ%40mail.gmail.com.

Reply via email to