Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 803
Juan Avatar asked Sep 27 '22 06:09

Juan


1 Answers

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

like image 65
Juan Avatar answered Sep 30 '22 08:09

Juan