简体   繁体   中英

How to use FS when MODULARIZE and EXPORT_NAME are used in emscripten

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM