pocketlang/tests/native/README.md

28 lines
837 B
Markdown
Raw Normal View History

## Example on how to integrate pocket VM with in your application.
2022-04-22 00:07:38 +08:00
- Including this example this repository contains several examples on how to
integrate pocket VM with your application
2021-07-01 17:23:16 +08:00
- These examples (currently 2 examples)
- The `cli/` application
- The `docs/try/main.c` web assembly version of pocketlang
- To integrate pocket VM in you project:
- Just drag and drop the `src/` directory in your project
- Add all C files in the directory with your source files
- Add `src/include` to the include path
- Compile
----
2021-07-01 17:23:16 +08:00
#### `example1.c` - Contains how to pass values between pocket VM and C
```
gcc example1.c -o example1 ../../src/*.c -I../../src/include -lm
```
2021-07-01 17:23:16 +08:00
#### `example2.c` - Contains how to create your own custom native type in C
```
2021-07-01 17:23:16 +08:00
gcc example2.c -o example2 ../../src/*.c -I../../src/include -lm
```