Skip to content

Commit

Permalink
Added gotcha regarding @export and C
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Nov 1, 2024
1 parent ddf1da6 commit c15865d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/content/docs/Language Common/cinterop.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,5 @@ the project file (e.g. `"linker-search-paths" = ["../mylibs/", "/extra-libs/"]`)
`extern fn void test(int* a)`. If the function has a sized array, like `void test2(int[4] b)`
replace it with a pointer to a sized array: `extern fn void test2(int[4]* b);`
- Note that a pointer to an array is always implicitly convertable to a pointer to the first element For example, `int[4]*` may be implicitly converted to `int*`.
- The C3 names of functions are name-spaced with the module by default when using `@export`, so when
exporting a function with `@export` that is to be used from C, specify an explicit external name. E.g. `fn void myfunc() @export("myfunc") { ... }`.

0 comments on commit c15865d

Please sign in to comment.