-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: seperate implementation from interface (#17)
* feat: seperate interface from implementation, cplusplus compat * feat: extism_log_sz
- Loading branch information
Showing
15 changed files
with
156 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.wasm | ||
*.o | ||
wasi-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "../../extism-pdk.h" | ||
|
||
#include <stdio.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "../../extism-pdk.h" | ||
|
||
#include <stdio.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "util.h" | ||
|
||
EXTISM_EXPORT_AS("run_test") int32_t run_test(void) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "util.h" | ||
#include <string.h> | ||
|
||
EXTISM_EXPORT_AS("run_test") int32_t run_test(void) { | ||
const char *msg = "Hello, world!"; | ||
ExtismPointer ptr = extism_alloc(strlen(msg)); | ||
assert(ptr > 0); | ||
extism_store(ptr, (const uint8_t *)msg, strlen(msg)); | ||
assert(extism_length(ptr) == strlen(msg)); | ||
extism_output_set(ptr, strlen(msg)); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "util.h" | ||
|
||
int32_t EXTISM_EXPORTED_FUNCTION(run_test) { | ||
const char *msg = "Some error message"; | ||
ExtismPointer ptr = extism_alloc(strlen(msg)); | ||
extism_store(ptr, (const uint8_t *)msg, strlen(msg)); | ||
ExtismPointer ptr = extism_alloc(extism_strlen(msg)); | ||
extism_store(ptr, (const uint8_t *)msg, extism_strlen(msg)); | ||
extism_error_set(ptr); | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "util.h" | ||
|
||
EXTISM_EXPORT_AS("run_test") int32_t run_test(void) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "../extism-pdk.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "util.h" | ||
|
||
EXTISM_EXPORT_AS("run_test") int32_t run_test(void) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#define EXTISM_IMPLEMENTATION | ||
#include "util.h" | ||
#include <string.h> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters