mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
d2c8b5f087
Fixes the error reported in #16304. > = note: /usr/bin/ld:/home/abotella/Projects/deno/cli/generated_symbol_exports_list_linux.def:1: syntax error in dynamic list collect2: error: ld returned 1 exit status This was caused by the format of the symbols list on Linux being malformed (as the error implies). The format is documented in ld's [VERSION](https://sourceware.org/binutils/docs/ld/VERSION.html) as well as: > --export-dynamic-symbol-list=file Specify a --export-dynamic-symbol for each pattern in the file. The format of the file is the same as the version node without scope and node name. See VERSION for more information. Previously, the format for the Linux symbols list was simply a list of symbols, now it follows the format: ``` { symbol_name_a; ...; symbol_name_z }; ``` |
||
---|---|---|
.. | ||
Cargo.toml | ||
generated_symbol_exports_list_linux.def | ||
generated_symbol_exports_list_macos.def | ||
generated_symbol_exports_list_windows.def | ||
lib.rs | ||
README.md | ||
symbol_exports.json |
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 aspub extern "C" $name
. - Asserts that the function symbol is present in
symbol_exports.json
. - Maps
deno_napi::Result
to rawnapi_result
.
use deno_napi::{napi_value, Env, Error, Result};
#[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
.