Commit f797096
committed
fix(cpp): support worlds with types
Adds __wasm_export_ prefix to all C ABI export function names
When a WIT world exports a function whose name matches the world/package
name (e.g., world "foo" with export function "foo"), the generated C ABI
function name foo() conflicted with the C++ namespace namespace foo.
This generates functions like:
```c
extern "C" __attribute__((__export_name__("foo")))
uint8_t * __wasm_export_foo() // C++ function name
```
The public C++ API is `exports::foo::Foo()`.
Users never see the __wasm_export_foo() function in the bindings.
Signed-off-by: Bailey Hayes <behayes2@gmail.com>1 parent 6c6cd43 commit f797096
2 files changed
+27
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
594 | | - | |
| 594 | + | |
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
599 | | - | |
600 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
601 | 602 | | |
602 | 603 | | |
603 | 604 | | |
| |||
973 | 974 | | |
974 | 975 | | |
975 | 976 | | |
| 977 | + | |
| 978 | + | |
976 | 979 | | |
977 | 980 | | |
978 | 981 | | |
| |||
2633 | 2636 | | |
2634 | 2637 | | |
2635 | 2638 | | |
2636 | | - | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
2637 | 2646 | | |
2638 | 2647 | | |
2639 | 2648 | | |
| |||
2998 | 3007 | | |
2999 | 3008 | | |
3000 | 3009 | | |
3001 | | - | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
3002 | 3017 | | |
3003 | 3018 | | |
3004 | 3019 | | |
| |||
3015 | 3030 | | |
3016 | 3031 | | |
3017 | 3032 | | |
3018 | | - | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
3019 | 3040 | | |
3020 | 3041 | | |
3021 | 3042 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 69 | | |
74 | 70 | | |
75 | 71 | | |
| |||
0 commit comments