crossbind
GitHub

Packages

A library comes as a package: a crossbind port from npm, a crate from crates.io or a Conan package. The project names it in crossbind.config.js and imports it like its own files.

main.js imports SQLite's own header from the @crossbind/port-sqlite3 port, and Version and VersionReq from the semver crate as cargo:semver. A port's header binds only the functions you import.

nlohmann_json, the Conan package, is all C++ templates, with no function of its own to bind. native.cpp includes it, and native.h declares pretty, the one function JavaScript needs.

The playground writes crossbind.config.js from the project's packages; a project of your own lists them there. Libraries has every port, and the guide covers crates.io and Conan.

Try it
Change ^1.2 to >=1.0, <1.4 and run it again. To add another package, open this step in the playground and press Add package.
Open in playgroundRuns without a compile until the C++, Rust, packages or imports change.
Console
Press Run, or Ctrl+Enter, to run main.js.

Where to go next

Type to search every guide page and section.
↑↓ navigate↵ openesc close