Commit e4e8f4ed
e4e8f4ed9d7cMerged
Richard Ramsden <[email protected]> · 6 months ago · 2 files · +2 added
Description
examples(ffi/libm): libc + libm smoke demo
The smallest possible FFI example — calls cos / sqrt / pow / strlen / getpid through the always-linked libc and libm. README documents the build line for fresh users.
Details
- Commit
- e4e8f4ed9d7c
- Parent
- 9f22f06bc9b9
examples/ffi/libm/README.mdaddedView file
1+
# libc / libm FFI demo2+
3+
Calls a handful of libc and libm functions directly. libc and libm are4+
linked into every Spinel binary by default, so no `ffi_lib` declaration5+
is needed for these.6+
7+
## Build & run8+
9+
From the repo root:10+
11+
```sh12+
./spinel examples/ffi/libm/libm.rb13+
./libm14+
```15+
16+
Expected output:17+
18+
```19+
120+
421+
102422+
1223+
pid > 0: true24+
```examples/ffi/libm/libm.rbaddedView file
Loading diff…