quickjs-done-nextgen/examples/test_fib.js

9 lines
244 B
JavaScript
Raw Permalink Normal View History

2020-09-06 16:53:08 +00:00
/* example of JS module importing a C module */
import * as os from "qjs:os";
2020-09-06 16:53:08 +00:00
2024-09-10 20:47:40 +00:00
const isWin = os.platform === 'win32';
const { fib } = await import(`./fib.${isWin ? 'dll' : 'so'}`);
2020-09-06 16:53:08 +00:00
console.log("Hello World");
console.log("fib(10)=", fib(10));