问题
I have an application that contains libraries generated with emscripten. I am compiling them using the flags:
-s MODULARIZE=1 -s EXPORT_NAME=\"'SomeModuleName'\"
However, the library FS is no longer available. When I was compiling without the flags, I could use the library FS in any other script.
Is it possible to export FS in my module?
回答1:
The FS module is not exported by default when using the flag
-s EXPORT_NAME="'SomeModuleName'"
If you want to export the module FS, you have to add the flag
-s 'EXTRA_EXPORTED_RUNTIME_METHODS=["FS"]'
Then you can access Module['FS']
or for this example it will be SomeModuleName['FS']
emscripten.
However, FS
is defined by each library and it won't be shared between them.
If you would like to have a 'common' shared space between libraries, you will need to use something like BrowserFS
来源:https://stackoverflow.com/questions/33623682/how-to-use-fs-when-modularize-and-export-name-are-used-in-emscripten