fix building C

This commit is contained in:
2026-02-16 18:47:43 -06:00
parent a1ee7dd458
commit 17e35f023f
5 changed files with 72 additions and 17 deletions

View File

@@ -244,6 +244,20 @@ audio_emscripten.c # Web/Emscripten
ƿit selects the appropriate file based on the target platform.
## Multi-File C Modules
If your module wraps a C library, place the library's source files in a `src/` directory. Files in `src/` are compiled as support objects and linked into your module's dylib — they are not treated as standalone modules.
```
mypackage/
rtree.c # module (exports js_mypackage_rtree_use)
src/
rtree.c # support file (linked into rtree.dylib)
rtree.h # header
```
The module file (`rtree.c`) includes the library header and uses `cell.h` as usual. The support files are plain C — they don't need any cell macros.
## Static Declarations
Keep internal functions and variables `static`: