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

非 Y 不嫁゛ 提交于 2019-12-12 12:19:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!