Emscripten

本页使用了标题或全文手工转换
维基百科,自由的百科全书
Emscripten
原作者Alon Zakai
当前版本
  • 3.1.57 (2024年4月9日;穩定版本)[1]
編輯維基數據鏈接
源代码库 編輯維基數據鏈接
编程语言CC++JavaScript[2]
类型編譯器
许可协议MITUIUC英语University of Illinois/NCSA Open Source License
网站emscripten.org/ 编辑维基数据

Emscripten是基於LLVM / Clang編譯器,用來将CC++源代码编译为WebAssembly [3]。在WebAssembly於2017年出現以前,JavaScript的子集asm.js曾是編譯目標 [4]

Emscripten 允许預先编译用 C 或 C++ 编写的应用程序和库以在網頁瀏覽器中運行,絕大多數的情況下運行速度與直譯(或即時編譯)的 JavaScript 相同或更快。Emscripten 甚至可以模拟整个POSIX操作系统,使程序员能够使用C標準函式庫(libc) 中的函数。 [5]

随着WebAssembly的接口(英語:WebAssembly System Interface,WASI)[6]运行时系统(例如Node.js、Wasmtime[7]和Wasmer[8])上的WebAssembly的開發進展,Emscripten也可编译成在網頁以外的地方使用的WebAssembly 。

用途

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

游戏引擎

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

框架和工具包

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

软件归档

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

參見

參考文獻

  1. ^ Release 3.1.57. 2024年4月9日 [2024年4月22日]. 
  2. ^ 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%. 
  3. ^ WebAssembly · emscripten-core/emscripten Wiki · GitHub. [2023-09-03]. (原始内容存档于2019-01-16). 
  4. ^ Walton, Zach. Easily Port C++ To HTML5/JavaScript With Emscripten. WebProNews. iEntry Network. 2012-04-04 [2012-04-25]. (原始内容存档于2013-07-30). 
  5. ^ 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). 
  6. ^ The Wasmtime Project. WASI: The WebAssembly System Interface. WASI.dev. The Wasmtime Project. [2021-02-10]. (原始内容存档于2022-07-05). 
  7. ^ The Wasmtime Project. Wasmtime: A small and efficient runtime for WebAssembly & WASI. Wasmtime.dev. The Wasmtime Project. [2021-02-10]. (原始内容存档于2020-12-04). 
  8. ^ Wasmer. Wasmer: The Universal WebAssembly Runtime. Wasmer.io. Wasmer. [2021-02-10]. (原始内容存档于2021-03-02). 
  9. ^ sqlite3 WebAssembly & JavaScript Documentation Index. SQLite. [2023-05-08]. 
  10. ^ http://www.meshlabjs.net页面存档备份,存于互联网档案馆) - Homepage of the experimental, client based, javascript, version of MeshLab that runs inside a browser
  11. ^ Porting Examples and Demos. Emscripten GitHub wiki. [2016-03-01]. (原始内容存档于2023-09-03). 
  12. ^ The Future of AutoCAD. Through the Interface. [2018-05-09]. (原始内容存档于2023-09-03). 
  13. ^ 13.0 13.1 Qt for WebAssembly. [2023-09-03]. (原始内容存档于2023-10-12). 
  14. ^ Unity game engine heading to the browser without plug-ins. Ars Technica. 18 March 2014 [2016-03-01]. (原始内容存档于2019-03-22). 
  15. ^ The future of scripting in Unity – Unity Blog. Unity Technologies Blog. [2016-03-01]. (原始内容存档于2016-03-04). 
  16. ^ Tappy Chicken. www.unrealengine.com. [2016-03-01]. (原始内容存档于2017-08-21). 
  17. ^ openFrameworks setup for Emscripten. openFrameworks. [2016-03-04]. (原始内容存档于2023-04-19). 
  18. ^ 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). 
  19. ^ Each New Boot a Miracle页面存档备份,存于互联网档案馆) by Jason Scott (December 23, 2014)
  20. ^ Internet Archive Search: "collection:softwarelibrary_msdos". archive.org. [2016-03-01]. 

外部链接