Skip to content

Commit

Permalink
docs: remove export section
Browse files Browse the repository at this point in the history
  • Loading branch information
G4Vi committed Aug 22, 2024
1 parent 09f5102 commit 695c794
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,6 @@ Compile:

* `-mexec-model=reactor` as we're building a [reactor](https://dylibso.com/blog/wasi-command-reactor/) module - exporting functions, not building a [command](https://dylibso.com/blog/wasi-command-reactor/) program.

## Exports (details)

The `EXTISM_EXPORTED_FUNCTION` macro is not essential to create a plugin function and export it to the host. You may instead write a function and then export it when linking. For example, the first example may have the following signature instead:

```c
int32_t greet(void)
```
Then, it can be built and linked with:
```bash
$WASI_SDK_PATH/bin/clang++ -o plugin.wasm --target=wasm32-wasi -Wl,--no-entry -Wl,--export=greet plugin.cpp
```

Note the `-Wl,--export=greet`

Exports names do not necessarily have to match the function name either. Going back to the first example again. Try:

```c
EXTISM_EXPORT_AS("greet") int32_t internal_name_for_greet(void)
```
and build with:
```bash
$WASI_SDK_PATH/bin/clang++ -o plugin.wasm --target=wasm32-wasi -Wl,--no-entry plugin.cpp
```

## Reach Out!

Have a question or just want to drop in and say hi? [Hop on the Discord](https://extism.org/discord)!

0 comments on commit 695c794

Please sign in to comment.