Python WAMR API binding: Add malloc/free and register_native (#1989)

This commit is contained in:
tonibofarull
2023-02-28 09:19:17 +01:00
committed by GitHub
parent 4ca57a0228
commit b4f0228497
3 changed files with 57 additions and 17 deletions

View File

@ -1,16 +1,8 @@
# WARM API
## Examples
## Setup
Copy in `language-bindings/python/wamr/libs` the library `libiwasm` generated from `product-mini/platforms`.
There is a [simple example](./samples/main.py) to show how to use bindings.
```
python samples/main.py
```
## Update WAMR API bindings
### Pre-requisites
Install requirements,
@ -18,8 +10,20 @@ Install requirements,
pip install -r requirements.txt
```
Run the following command,
### Build native lib and update bindings
The following command builds the iwasm library and generates the Python bindings,
```sh
ctypesgen ../../../../core/iwasm/include/wasm_export.h -l ../libs/libiwasm.so -o iwasm.py
bash language-bindings/python/utils/create_lib.sh
```
This will build and copy libiwasm into the package.
## Examples
There is a [simple example](./samples/main.py) to show how to use bindings.
```
python samples/main.py
```