diff options
author | 2022-05-03 01:25:46 -0700 | |
---|---|---|
committer | 2022-05-03 01:25:46 -0700 | |
commit | 8b1924f6c2bfdc7f199e95e6564a8a51e4312ef5 (patch) | |
tree | 83f6b48aa724ee8b6b773590aa106a9f6d46d72d /examples/add.ts | |
parent | c6d732eee2721cd6191672cbe2c57fb17c3fffe4 (diff) | |
download | bun-8b1924f6c2bfdc7f199e95e6564a8a51e4312ef5.tar.gz bun-8b1924f6c2bfdc7f199e95e6564a8a51e4312ef5.tar.zst bun-8b1924f6c2bfdc7f199e95e6564a8a51e4312ef5.zip |
Add docs for FFI
Diffstat (limited to 'examples/add.ts')
-rw-r--r-- | examples/add.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/add.ts b/examples/add.ts new file mode 100644 index 000000000..e975b122e --- /dev/null +++ b/examples/add.ts @@ -0,0 +1,12 @@ +import { dlopen, suffix } from "bun:ffi"; + +const { + symbols: { add }, +} = dlopen(`./libadd.${suffix}`, { + add: { + args: ["i32", "i32"], + returns: "i32", + }, +}); + +console.log(add(1, 2)); |