Emscripten

维基百科,自由的百科全书
跳转到导航 跳转到搜索
Emscripten
File:Emscripten logo.svg
原作者Alon Zakai
当前版本
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    源代码库
    • {{URL|example.com|可选的显示文本}}
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    编程语言CC++JavaScript[1]
    引擎
      Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
      类型编译器
      许可协议MITUIUC英语University of Illinois/NCSA Open Source License

      Emscripten是基于LLVM / Clang编译器,用来将CC++源代码编译为WebAssembly [2]。在WebAssembly于2017年出现以前,JavaScript的子集asm.js曾是编译目标 [3]

      Emscripten 允许预先编译用 C 或 C++ 编写的应用程序和库以在网页浏览器中运行,绝大多数的情况下运行速度与直译(或即时编译)的 JavaScript 相同或更快。Emscripten 甚至可以模拟整个POSIX操作系统,使程序员能够使用C标准函数库(libc) 中的函数。 [4]

      随着WebAssembly的接口(英语:WebAssembly System Interface,WASI)[5]运行时系统(例如Node.js、Wasmtime[6]和Wasmer[7])上的WebAssembly的开发进展,Emscripten也可编译成在网页以外的地方使用的WebAssembly 。

      用途[编辑]

      Emscripten 已让许多 C/C++ 代码库顺利移植到WebAssembly,包括Unreal Engine 3SQLite[8]MeshLab[9]Bulletphysical 。 [10]AutoCAD [11]Qt 应用程序框架的子集等等。[12]通过 Emscripten 顺利移植到 WebAssembly 的其他软件示例包括:

      游戏引擎[编辑]

      UnityGodotUnreal游戏引擎利用Emscripten提供了HTML5的导出选项。 [13][14][15]

      框架和工具包[编辑]

      openFrameworks英语openFrameworks 通过 Emscripten 将本机 C++ 应用程序导出成 HTML5。[16]emscripten-qt允许将使用Qt 应用程序框架编写的应用程序编译为WebAssembly。[12]

      软件归档[编辑]

      2014年12月,互联网档案馆推出了用Emscripten编译的DOSBox模拟器,提供数千个基于浏览器的存档的MS-DOS和PC程序。[17][18][19]

      参见[编辑]

      参考文献[编辑]

      1. ^ emscripten-core/emscripten: Emscripten: An LLVM-to-JavaScript Compiler. GitHub. [2023-09-03]. (原始内容存档于2023-09-03). C: 40.0%; C++: 34.4%; JavaScript: 17.4%. 
      2. ^ WebAssembly · emscripten-core/emscripten Wiki · GitHub. [2023-09-03]. (原始内容存档于2019-01-16). 
      3. ^ Walton, Zach. Easily Port C++ To HTML5/JavaScript With Emscripten. WebProNews. iEntry Network. 2012-04-04 [2012-04-25]. (原始内容存档于2013-07-30). 
      4. ^ Clark, Lin. Standardizing WASI: A system interface to run WebAssembly outside the web – Mozilla Hacks - the Web developer blog. Mozilla Hacks – the Web developer blog. Mozilla. [31 October 2022]. (原始内容存档于2022-10-30). 
      5. ^ The Wasmtime Project. WASI: The WebAssembly System Interface. WASI.dev. The Wasmtime Project. [2021-02-10]. (原始内容存档于2022-07-05). 
      6. ^ The Wasmtime Project. Wasmtime: A small and efficient runtime for WebAssembly & WASI. Wasmtime.dev. The Wasmtime Project. [2021-02-10]. (原始内容存档于2020-12-04). 
      7. ^ Wasmer. Wasmer: The Universal WebAssembly Runtime. Wasmer.io. Wasmer. [2021-02-10]. (原始内容存档于2021-03-02). 
      8. ^ sqlite3 WebAssembly & JavaScript Documentation Index. SQLite. [2023-05-08]. (原始内容存档于2024-05-02). 
      9. ^ http://www.meshlabjs.net页面存档备份,存于互联网档案馆) - Homepage of the experimental, client based, javascript, version of MeshLab that runs inside a browser
      10. ^ Porting Examples and Demos. Emscripten GitHub wiki. [2016-03-01]. (原始内容存档于2023-09-03). 
      11. ^ The Future of AutoCAD. Through the Interface. [2018-05-09]. (原始内容存档于2023-09-03). 
      12. ^ 12.0 12.1 Qt for WebAssembly. [2023-09-03]. (原始内容存档于2023-10-12). 
      13. ^ Unity game engine heading to the browser without plug-ins. Ars Technica. 18 March 2014 [2016-03-01]. (原始内容存档于2019-03-22). 
      14. ^ The future of scripting in Unity – Unity Blog. Unity Technologies Blog. [2016-03-01]. (原始内容存档于2016-03-04). 
      15. ^ Tappy Chicken. www.unrealengine.com. [2016-03-01]. (原始内容存档于2017-08-21). 
      16. ^ openFrameworks setup for Emscripten. openFrameworks. [2016-03-04]. (原始内容存档于2023-04-19). 
      17. ^ Ohlheiser, Abby. You can now play nearly 2,400 MS-DOS video games in your browser. The Washington Post. 2015-01-05 [2015-01-08]. (原始内容存档于2015-01-07). 
      18. ^ Each New Boot a Miracle页面存档备份,存于互联网档案馆) by Jason Scott (December 23, 2014)
      19. ^ Internet Archive Search: "collection:softwarelibrary_msdos". archive.org. [2016-03-01]. 

      外部链接[编辑]