fix building C
This commit is contained in:
@@ -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`:
|
||||
|
||||
Reference in New Issue
Block a user