@@ -7,35 +7,45 @@ Binaries are provided as a
77[ package on JSR] ( https://jsr.io/@serial/cpp-bindings-linux ) . They are serialized
88as a base64 string inside the JSON file.
99
10+ The contained shared libraries and FFI metadata are runtime-agnostic. They can
11+ be used by any language or runtime that can decode base64, write a file, load a
12+ GNU/Linux shared library, and call its C ABI. The TypeScript exports are a
13+ convenient distribution format, not a dependency on a particular runtime.
14+
1015The package contains portable binaries for ` x86_64-linux-gnu ` and
1116` aarch64-linux-gnu ` , both requiring glibc 2.28 or newer. The x86-64 artifact
1217uses the generic x86-64 baseline.
1318
1419It also includes cpp-core FFI API metadata generated with
1520[ ASTrein] ( https://github.com/Katze719/ASTrein ) at ` bin/x86_64/ffi.json ` and
1621` bin/aarch64/ffi.json ` . It describes the exported C symbols, parameter and
17- return types, callbacks, default values, and API documentation used by
18- downstream FFI adapter generators.
22+ return types, callbacks, structs, default values, and API documentation used by
23+ runtime-specific FFI adapter generators.
1924
2025This package is primarily intended as a dependency for
2126[ ` @serial/serial ` ] ( https://jsr.io/@serial/serial ) . However, it can also be used
2227independently.
2328
2429## Usage
2530
26- Import the JSON and write the binary data to disk . Each architecture export also
27- contains its matching FFI metadata:
31+ Select the export matching the host architecture . Each export contains the
32+ base64-encoded shared library and its matching FFI metadata:
2833
2934``` ts
3035import { aarch64 , x86_64 } from " @serial/cpp-bindings-linux/bin" ;
3136
32- const binary = Deno . build . arch === " aarch64 " ? aarch64 : x86_64 ;
33- Deno . writeFileSync ( ` ./${ binary . filename } ` , Uint8Array . fromBase64 ( binary . data )) ;
37+ // Select this with the architecture API provided by your runtime.
38+ const binary = x86_64 ;
3439
35- // The matching FFI metadata is available as `binary.ffi`.
36- // Now you can open the binary using for example `Deno.dlopen`...
40+ // Decode `binary.data`, write it to `binary.filename`, and load it using your
41+ // runtime's filesystem and native FFI APIs. `binary.ffi` describes the C API
42+ // and its structs for generating or configuring a runtime-specific adapter.
3743```
3844
45+ Non-JavaScript consumers can download the same architecture-specific ` .so ` and
46+ ` .ffi.json ` files directly from the
47+ [ GitHub releases] ( https://github.com/Serial-IO/cpp-bindings-linux/releases ) .
48+
3949> [ !NOTE]
4050> For a more in depth guide, check out the
4151> [ Wiki] ( https://github.com/Serial-IO/cpp-bindings-linux/wiki ) section on how to
0 commit comments