deno/ext/napi/sym
denobot 5612d2edc7
Some checks are pending
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
2.4.3 (#30251)
Bumped versions for 2.4.3

Please ensure:
- [x] Crate versions are bumped correctly
- [x] Releases.md is updated correctly (think relevancy and remove
reverts)

To make edits to this PR:
```shell
git fetch upstream release_2_4.3 && git checkout -b release_2_4.3 upstream/release_2_4.3
```

cc @crowlKats

---------

Signed-off-by: Leo Kettmeir <64b2b6d@kettmeir.dev>
Co-authored-by: crowlKats <crowlKats@users.noreply.github.com>
Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2025-07-30 22:25:42 +00:00
..
Cargo.toml 2.4.3 (#30251) 2025-07-30 22:25:42 +00:00
lib.rs chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
README.md chore: update to edition 2024 (#29923) 2025-07-02 17:59:39 -07:00
symbol_exports.json feat: support node-api in denort (#26389) 2024-10-24 09:13:54 +02:00

napi_sym

A proc_macro for Deno's Node-API implementation. It does the following things:

  • Marks the symbol as #[no_mangle] and rewrites it as unsafe extern "C" $name.
  • Asserts that the function symbol is present in symbol_exports.json.
  • Maps deno_napi::Result to raw napi_result.
use deno_napi::Env;
use deno_napi::Error;
use deno_napi::Result;
use deno_napi::napi_value;

#[napi_sym::napi_sym]
fn napi_get_boolean(
  env: *mut Env,
  value: bool,
  result: *mut napi_value,
) -> Result {
  let _env: &mut Env = env.as_mut().ok_or(Error::InvalidArg)?;
  // *result = ...
  Ok(())
}

symbol_exports.json

A file containing the symbols that need to be put into the executable's dynamic symbol table at link-time.

This is done using /DEF: on Windows, -exported_symbol,_ on macOS and --export-dynamic-symbol= on Linux. See cli/build.rs.

On Windows, you need to generate the .def file by running tools/napi/generate_symbols_lists.js.