feat(pkg): phase 15 - a package can carry a native library
native "<target>" "<path>" in a package's package.ludic; the compiler records the libraries of every package a program imports and writes them into the IR (; ludic-native:), so ludicc -o, ludic build, ludic test and ludic bundle all link one list. macOS: an rpath to the package and to Contents/Frameworks, where ludic bundle copies and signs each library and drops the build machine's rpath. Windows: the import library, the .dll copied beside the exe (--natives-out for the bundle). tools/native/lib.sh builds from a pinned, checksummed source with clang on both machines; ludic.nativeecho is the worked example; the shim rules are in packages/README.md. Linked at build time rather than dlopen (docs/PACKAGES.md says why). Reseeded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5df0747642
commit
5d3a799e33
25 changed files with 54474 additions and 51707 deletions
26
packages/ludic.nativeecho/README.md
Normal file
26
packages/ludic.nativeecho/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# ludic.nativeecho
|
||||
|
||||
The worked example of a package that carries a native library (phase 15). It exists to be copied
|
||||
and to be tested: nothing in a game needs it.
|
||||
|
||||
```ludic
|
||||
import "ludic.nativeecho"
|
||||
```
|
||||
|
||||
- `package.ludic` names the library per target (`native "macos-arm64" "lib/macos-arm64/libnativeecho.dylib"`).
|
||||
- `native/shim/nativeecho.c` is the whole library: a sum over a float slice, a scan that
|
||||
"calls back" once per value over a threshold, and the drain the package empties those records
|
||||
through.
|
||||
- `native/build.sh` builds `lib/<target>/` through `tools/native/lib.sh` (no upstream to fetch).
|
||||
- `native.ludic` declares the symbols; `echo.ludic` is the state, the verbs and the facts.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| `EchoState` | the slices that cross to C (made once), and the facts queue |
|
||||
| `echo_put(st, x) -> bool`, `echo_clear(st)` | fill the slice |
|
||||
| `echo_sum(st) -> float` | the sum, in C |
|
||||
| `echo_scan(st, over) -> int` | C records each value over `over`; they arrive on `echo_facts(st)` as `EchoFact { index, value }` |
|
||||
| `echo_lost() -> int`, `echo_twice(x: long) -> long` | the lost-record count, and a 64-bit round trip |
|
||||
|
||||
The rules it keeps are the shim rules in [packages/README.md](../README.md#native-libraries).
|
||||
`ludic test packages/ludic.nativeecho` runs it against the real library.
|
||||
Loading…
Add table
Add a link
Reference in a new issue