koffi 2.14.0 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/build/koffi/darwin_arm64/koffi.node +0 -0
- package/build/koffi/darwin_x64/koffi.node +0 -0
- package/build/koffi/freebsd_arm64/koffi.node +0 -0
- package/build/koffi/freebsd_ia32/koffi.node +0 -0
- package/build/koffi/freebsd_x64/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_armhf/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_loong64/koffi.node +0 -0
- package/build/koffi/linux_riscv64d/koffi.node +0 -0
- package/build/koffi/linux_x64/koffi.node +0 -0
- package/build/koffi/musl_arm64/koffi.node +0 -0
- package/build/koffi/musl_x64/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/koffi/openbsd_x64/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/koffi/win32_ia32/koffi.node +0 -0
- package/build/koffi/win32_x64/koffi.node +0 -0
- package/doc/pages/index.md +43 -4
- package/doc/pages/platforms.md +8 -19
- package/doc/pages.ini +0 -7
- package/doc/static/perf_windows.png +0 -0
- package/index.js +3 -2
- package/indirect.js +3 -2
- package/package.json +3 -2
- package/src/cnoke/src/builder.js +1 -2
- package/src/core/base/base.cc +791 -555
- package/src/core/base/base.hh +577 -450
- package/src/core/base/crc.inc +1 -1
- package/src/core/base/crc_gen.py +1 -1
- package/src/core/base/unicode.inc +1 -1
- package/src/core/base/unicode_gen.py +1 -1
- package/src/koffi/src/abi_arm32.cc +24 -24
- package/src/koffi/src/abi_arm64.cc +29 -29
- package/src/koffi/src/abi_riscv64.cc +27 -27
- package/src/koffi/src/abi_x64_sysv.cc +29 -29
- package/src/koffi/src/abi_x64_win.cc +20 -20
- package/src/koffi/src/abi_x86.cc +26 -26
- package/src/koffi/src/call.cc +82 -236
- package/src/koffi/src/call.hh +6 -6
- package/src/koffi/src/ffi.cc +60 -60
- package/src/koffi/src/ffi.hh +9 -9
- package/src/koffi/src/parser.cc +2 -2
- package/src/koffi/src/parser.hh +1 -1
- package/src/koffi/src/trampolines/prototypes.inc +1 -1
- package/src/koffi/src/util.cc +43 -43
- package/src/koffi/src/util.hh +5 -5
- package/src/koffi/src/win32.cc +5 -5
- package/src/koffi/src/win32.hh +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
### Koffi 2.14
|
|
9
9
|
|
|
10
|
+
#### Koffi 2.14.1
|
|
11
|
+
|
|
12
|
+
*Released on 2025-09-13*
|
|
13
|
+
|
|
14
|
+
- Recompile Linux (musl) ARM64 prebuild with Alpine 3.20 (instead of Alpine edge)
|
|
15
|
+
- Clean up redundant code paths for handling string arguments
|
|
16
|
+
|
|
10
17
|
#### Koffi 2.14.0
|
|
11
18
|
|
|
12
19
|
*Released on 2025-08-17*
|
|
@@ -980,7 +987,6 @@ This entry documents changes since version 1.1.0.
|
|
|
980
987
|
|
|
981
988
|
The following features and improvements are planned, not necessarily in that order:
|
|
982
989
|
|
|
983
|
-
- Port Koffi to Loong64 ISA and ABI
|
|
984
990
|
- Port Koffi to PowerPC (POWER9+) ISA and ABI
|
|
985
991
|
- Optimize passing of structs and arrays (with auto-generated JS)
|
|
986
992
|
- Automate Windows/AArch64 (qemu) and macOS/AArch64 (how? ... thanks Apple) tests
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Koffi is a fast and easy-to-use C FFI module for Node.js, featuring:
|
|
|
4
4
|
|
|
5
5
|
* Low-overhead and fast performance (see [benchmarks](https://koffi.dev/benchmarks))
|
|
6
6
|
* Support for primitive and aggregate data types (structs and fixed-size arrays), both by reference (pointer) and by value
|
|
7
|
-
* Javascript functions can be used as C callbacks
|
|
7
|
+
* Javascript functions can be used as C callbacks
|
|
8
8
|
* Well-tested code base for popular OS/architecture combinations
|
|
9
9
|
|
|
10
10
|
The following combinations of OS and architectures __are officially supported and tested__ at the moment:
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/doc/pages/index.md
CHANGED
|
@@ -1,16 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Overview
|
|
2
2
|
|
|
3
3
|
Koffi is a **fast and easy-to-use C FFI module for Node.js**, featuring:
|
|
4
4
|
|
|
5
5
|
* Low-overhead and fast performance (see [benchmarks](benchmarks))
|
|
6
6
|
* Support for primitive and aggregate data types (structs and fixed-size arrays), both by reference (pointer) and by value
|
|
7
|
-
* Javascript functions can be used as C callbacks
|
|
8
|
-
* Well-tested code base for
|
|
7
|
+
* Javascript functions can be used as C callbacks
|
|
8
|
+
* Well-tested code base for popular OS/architecture combinations
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
I work on this project on my spare time, if you like this project, consider supporting me:
|
|
11
|
+
|
|
12
|
+
<p style="display: flex; gap: 2em; justify-content: center;">
|
|
13
|
+
<a href="https://buymeacoffee.com/koromix" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174" style="border-radius: 12px;"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
Koffi requires [Node.js](https://nodejs.org/) version 16 or later. Use [NVM](https://github.com/nvm-sh/nvm) to install more recent Node versions on older Linux distributions.
|
|
17
|
+
|
|
18
|
+
The following combinations of OS and architectures __are officially supported and tested__ at the moment:
|
|
19
|
+
|
|
20
|
+
ISA / OS | Windows | Linux (glibc) | Linux (musl) | macOS | FreeBSD | OpenBSD
|
|
21
|
+
------------------ | ------- | ------------- | ------------ | ----- | ------- | -------
|
|
22
|
+
x86 (IA32) [^2] | ✅ | ✅ | 🟨 | ⬜️ | ✅ | ✅
|
|
23
|
+
x86_64 (AMD64) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅
|
|
24
|
+
ARM32 LE [^3] | ⬜️ | ✅ | 🟨 | ⬜️ | 🟨 | 🟨
|
|
25
|
+
ARM64 (AArch64) LE | ✅ | ✅ | ✅ | ✅ | ✅ | 🟨
|
|
26
|
+
RISC-V 64 [^4] | ⬜️ | ✅ | 🟨 | ⬜️ | 🟨 | 🟨
|
|
27
|
+
LoongArch64 | ⬜️ | ✅ | 🟨 | ⬜️ | 🟨 | 🟨
|
|
28
|
+
|
|
29
|
+
<div class="legend">✅ Yes | 🟨 Probably | ⬜️ Not applicable</div>
|
|
30
|
+
|
|
31
|
+
[^2]: The following call conventions are supported for forward calls: cdecl, stdcall, MS fastcall, thiscall. Only cdecl and stdcall can be used for C to JS callbacks.
|
|
32
|
+
[^3]: The prebuilt binary uses the hard float ABI and expects a VFP coprocessor. Build from source to use Koffi with a different ABI (softfp, soft).
|
|
33
|
+
[^4]: The prebuilt binary uses the LP64D (double-precision float) ABI. The LP64 ABI is supported in theory if you build Koffi from source (untested), the LP64F ABI is not supported.
|
|
34
|
+
|
|
35
|
+
For all fully supported platforms (green check marks), a prebuilt binary is included in the NPM package which means you can install Koffi without a C++ compiler.
|
|
36
|
+
|
|
37
|
+
# Source code
|
|
11
38
|
|
|
12
39
|
The source code is available here: https://github.com/Koromix/rygel/ (in the *src/koffi* subdirectory).
|
|
13
40
|
|
|
41
|
+
> [!NOTE]
|
|
42
|
+
> Most of my projects live in a single repository (or monorepo), which have two killer features for me:
|
|
43
|
+
>
|
|
44
|
+
> - Cross-project refactoring
|
|
45
|
+
> - Simplified dependency management
|
|
46
|
+
>
|
|
47
|
+
> You can find a more detailed rationale here: https://danluu.com/monorepo/
|
|
48
|
+
|
|
14
49
|
New releases are frequent, look at the [changelog](changelog) for more information.
|
|
15
50
|
|
|
16
51
|
# License
|
|
@@ -18,3 +53,7 @@ New releases are frequent, look at the [changelog](changelog) for more informati
|
|
|
18
53
|
This program is free software: you can redistribute it and/or modify it under the terms of the **MIT License**.
|
|
19
54
|
|
|
20
55
|
Find more information here: https://choosealicense.com/licenses/mit/
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
table td:not(:first-child) { text-align: center; }
|
|
59
|
+
</style>
|
package/doc/pages/platforms.md
CHANGED
|
@@ -14,25 +14,14 @@ Use [NVM](https://github.com/nvm-sh/nvm) to install more recent Node versions on
|
|
|
14
14
|
|
|
15
15
|
The following combinations of OS and architectures __are officially supported and tested__ at the moment:
|
|
16
16
|
|
|
17
|
-
ISA / OS | Windows
|
|
18
|
-
------------------ |
|
|
19
|
-
x86 (IA32) [^1] | ✅ | ✅
|
|
20
|
-
x86_64 (AMD64) | ✅ | ✅
|
|
21
|
-
ARM32 LE [^2] | ⬜️
|
|
22
|
-
ARM64 (AArch64) LE | ✅ | ✅
|
|
23
|
-
RISC-V 64 [^3] | ⬜️
|
|
24
|
-
LoongArch64 | ⬜️
|
|
25
|
-
|
|
26
|
-
<div class="legend">✅ Yes | 🟨 Probably | ⬜️ Not applicable</div>
|
|
27
|
-
|
|
28
|
-
ISA / OS | macOS | FreeBSD | OpenBSD
|
|
29
|
-
------------------ | ----- | ----------- | --------
|
|
30
|
-
x86 (IA32) [^1] | ⬜️ | ✅ | ✅
|
|
31
|
-
x86_64 (AMD64) | ✅ | ✅ | ✅
|
|
32
|
-
ARM32 LE [^2] | ⬜️ | 🟨 | 🟨
|
|
33
|
-
ARM64 (AArch64) LE | ✅ | ✅ | 🟨
|
|
34
|
-
RISC-V 64 [^3] | ⬜️ | 🟨 | 🟨
|
|
35
|
-
LoongArch64 | ⬜️ | 🟨 | 🟨
|
|
17
|
+
ISA / OS | Windows | Linux (glibc) | Linux (musl) | macOS | FreeBSD | OpenBSD
|
|
18
|
+
------------------ | ----------- | ------------- | ------------ | ----------- | ----------- | --------
|
|
19
|
+
x86 (IA32) [^1] | ✅ Yes | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | ✅ Yes | ✅ Yes
|
|
20
|
+
x86_64 (AMD64) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes
|
|
21
|
+
ARM32 LE [^2] | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
|
|
22
|
+
ARM64 (AArch64) LE | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | 🟨 Probably
|
|
23
|
+
RISC-V 64 [^3] | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
|
|
24
|
+
LoongArch64 | ⬜️ *N/A* | ✅ Yes | 🟨 Probably | ⬜️ *N/A* | 🟨 Probably | 🟨 Probably
|
|
36
25
|
|
|
37
26
|
<div class="legend">✅ Yes | 🟨 Probably | ⬜️ Not applicable</div>
|
|
38
27
|
|
package/doc/pages.ini
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
Title = Koffi
|
|
3
3
|
Menu = Overview
|
|
4
4
|
Description = Koffi presentation and features
|
|
5
|
-
ToC = Off
|
|
6
|
-
Template = templates/page.html
|
|
7
|
-
|
|
8
|
-
[pages/platforms.md]
|
|
9
|
-
Title = Requirements | Koffi
|
|
10
|
-
Menu = Documentation / Requirements
|
|
11
|
-
Description = Supported systemd and architectures
|
|
12
5
|
Template = templates/page.html
|
|
13
6
|
|
|
14
7
|
[pages/start.md]
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -402,7 +402,7 @@ var require_package = __commonJS({
|
|
|
402
402
|
"../../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
|
|
403
403
|
module2.exports = {
|
|
404
404
|
name: "koffi",
|
|
405
|
-
version: "2.14.
|
|
405
|
+
version: "2.14.1",
|
|
406
406
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
407
407
|
keywords: [
|
|
408
408
|
"foreign",
|
|
@@ -438,7 +438,8 @@ var require_package = __commonJS({
|
|
|
438
438
|
node: 16,
|
|
439
439
|
napi: 8,
|
|
440
440
|
require: "./index.js"
|
|
441
|
-
}
|
|
441
|
+
},
|
|
442
|
+
funding: "https://buymeacoffee.com/koromix"
|
|
442
443
|
};
|
|
443
444
|
}
|
|
444
445
|
});
|
package/indirect.js
CHANGED
|
@@ -402,7 +402,7 @@ var require_package = __commonJS({
|
|
|
402
402
|
"../../../bin/Koffi/package/src/koffi/package.json"(exports2, module2) {
|
|
403
403
|
module2.exports = {
|
|
404
404
|
name: "koffi",
|
|
405
|
-
version: "2.14.
|
|
405
|
+
version: "2.14.1",
|
|
406
406
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
407
407
|
keywords: [
|
|
408
408
|
"foreign",
|
|
@@ -438,7 +438,8 @@ var require_package = __commonJS({
|
|
|
438
438
|
node: 16,
|
|
439
439
|
napi: 8,
|
|
440
440
|
require: "./index.js"
|
|
441
|
-
}
|
|
441
|
+
},
|
|
442
|
+
funding: "https://buymeacoffee.com/koromix"
|
|
442
443
|
};
|
|
443
444
|
}
|
|
444
445
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.1",
|
|
4
4
|
"description": "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -33,5 +33,6 @@
|
|
|
33
33
|
"node": 16,
|
|
34
34
|
"napi": 8,
|
|
35
35
|
"require": "./index.js"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"funding": "https://buymeacoffee.com/koromix"
|
|
37
38
|
}
|
package/src/cnoke/src/builder.js
CHANGED
|
@@ -309,8 +309,7 @@ function Builder(config = {}) {
|
|
|
309
309
|
tools.unlink_recursive(build_dir);
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
-
function find_parent_directory(dirname, basename)
|
|
313
|
-
{
|
|
312
|
+
function find_parent_directory(dirname, basename) {
|
|
314
313
|
if (process.platform == 'win32')
|
|
315
314
|
dirname = dirname.replace(/\\/g, '/');
|
|
316
315
|
|