aboutsummaryrefslogtreecommitdiff
path: root/examples/add.ts
blob: e975b122e08f05df8dfee5031664c2aaf641107d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
import { dlopen, suffix } from "bun:ffi";

const {
  symbols: { add },
} = dlopen(`./libadd.${suffix}`, {
  add: {
    args: ["i32", "i32"],
    returns: "i32",
  },
});

console.log(add(1, 2));