Emscripten是基於LLVM / Clang編譯器,用來將CC++原始碼編譯為WebAssembly [3]。在WebAssembly於2017年出現以前,JavaScript的子集asm.js曾是編譯目標 [4]

Emscripten
原作者Alon Zakai
目前版本
  • 3.1.57 (2024年4月9日;穩定版本)[1]
編輯維基數據連結
原始碼庫 編輯維基數據連結
程式語言CC++JavaScript[2]
類型編譯器
許可協定MITUIUC英語University of Illinois/NCSA Open Source License
網站emscripten.org/ 編輯維基數據

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]. 

外部連結 編輯