wasmerio / wasmer-php

🐘🕸️ WebAssembly runtime for PHP
https://wasmerio.github.io/wasmer-php/wasm/
MIT License
1.01k stars 42 forks source link

feat: Implement `wasm_compile` and `wasm_module_new_instance` #21

Closed Hywan closed 5 years ago

Hywan commented 5 years ago

Fix #16.

Basic usage:

$bytes = wasm_read_bytes('my_program.wasm');
$module = wasm_compile($bytes);
$instance = wasm_module_new_instance($module);

Thus, wasm_new_instance is just a shortcut of wasm_compile + wasm_module_new_instance, except that the module is “hidden”.

This patch implements these two functions, add tests, and add the documentation.

These functions are not used yet in the Wasm library.