在emscripten中使用MODULARIZE和EXPORT_NAME时如何使用FS [英] How to use FS when MODULARIZE and EXPORT_NAME are used in emscripten

查看:899
本文介绍了在emscripten中使用MODULARIZE和EXPORT_NAME时如何使用FS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含使用emscripten生成的库的应用程序。
我正在使用标记编译它们:

  -s MODULARIZE = 1 -s EXPORT_NAME = \'SomeModuleName '\

但是,库FS不再可用。当我没有标记编译时,我可以在任何其他脚本中使用库FS。



可以在我的模块中导出FS吗?

解决方案

使用标志时FS模块默认情况下不会导出

  -s EXPORT_NAME ='SomeModuleName'

如果要导出模块FS,则必须添加标志

  -s'EXTRA_EXPORTED_RUNTIME_METHODS = [FS]'

然后,您可以访问 Module ['FS'] ,或者对于此示例,它将是 SomeModuleName ['FS'] emscripten



但是, FS 由每个库定义,它们之间不会共享。
如果您希望在图书馆之间拥有共同共享空间,则需要使用像 BrowserFS


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

这篇关于在emscripten中使用MODULARIZE和EXPORT_NAME时如何使用FS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆