koffi 1.3.9 → 1.3.10
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 +12 -0
- package/build/qemu/1.3.10/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.10/koffi_win32_x64.tar.gz +0 -0
- package/doc/benchmarks.md +2 -2
- package/doc/conf.py +1 -1
- package/doc/contribute.md +1 -1
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/changes.doctree +0 -0
- package/doc/dist/doctrees/contribute.doctree +0 -0
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/functions.doctree +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/doctrees/memory.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +0 -0
- package/doc/dist/html/.buildinfo +1 -1
- package/doc/dist/html/_sources/benchmarks.md.txt +2 -2
- package/doc/dist/html/_sources/contribute.md.txt +1 -2
- package/doc/dist/html/_sources/functions.md.txt +137 -15
- package/doc/dist/html/_sources/index.rst.txt +2 -0
- package/doc/dist/html/_sources/memory.md.txt +1 -1
- package/doc/dist/html/_sources/types.md.txt +27 -11
- package/doc/dist/html/_static/basic.css +14 -12
- package/doc/dist/html/_static/pygments.css +54 -54
- package/doc/dist/html/benchmarks.html +3 -3
- package/doc/dist/html/changes.html +1 -1
- package/doc/dist/html/contribute.html +2 -3
- package/doc/dist/html/functions.html +206 -86
- package/doc/dist/html/genindex.html +1 -1
- package/doc/dist/html/index.html +6 -7
- package/doc/dist/html/memory.html +4 -4
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +2 -2
- package/doc/dist/html/search.html +1 -1
- package/doc/dist/html/searchindex.js +1 -1
- package/doc/dist/html/start.html +55 -55
- package/doc/dist/html/types.html +172 -159
- package/doc/functions.md +9 -7
- package/doc/index.rst +2 -0
- package/doc/memory.md +1 -1
- package/doc/poetry.lock +692 -0
- package/doc/pyproject.toml +18 -0
- package/doc/{_static → static}/bench_linux.png +0 -0
- package/doc/{_static → static}/bench_windows.png +0 -0
- package/doc/{_static → static}/custom.css +0 -0
- package/doc/{_static → static}/perf_linux_20220623.png +0 -0
- package/doc/{_static → static}/perf_linux_20220623_2.png +0 -0
- package/doc/{_static → static}/perf_linux_20220627.png +0 -0
- package/doc/{_static → static}/perf_linux_20220628.png +0 -0
- package/doc/{_static → static}/perf_windows_20220623.png +0 -0
- package/doc/{_static → static}/perf_windows_20220623_2.png +0 -0
- package/doc/{_static → static}/perf_windows_20220627.png +0 -0
- package/doc/{_static → static}/perf_windows_20220628.png +0 -0
- package/doc/types.md +1 -1
- package/package.json +1 -1
- package/qemu/qemu.js +3 -3
- package/src/abi_arm32.cc +3 -3
- package/src/abi_riscv64.cc +1 -1
- package/src/abi_x64_sysv.cc +1 -1
- package/src/abi_x64_win.cc +1 -1
- package/src/abi_x64_win_fwd.asm +2 -2
- package/src/abi_x86.cc +5 -5
- package/build/qemu/1.3.9/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.9/koffi_win32_x64.tar.gz +0 -0
package/doc/functions.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Functions
|
|
2
2
|
|
|
3
3
|
## Function definitions
|
|
4
4
|
|
|
@@ -23,7 +23,7 @@ const printf = lib.func('printf', 'int', ['str', '...']);
|
|
|
23
23
|
const atoi = lib.func('atoi', 'int', ['str']);
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Koffi automatically tries mangled names for non-standard x86 calling conventions. See the section
|
|
26
|
+
Koffi automatically tries mangled names for non-standard x86 calling conventions. See the section on [calling conventions](#calling-conventions) for more information on this subject.
|
|
27
27
|
|
|
28
28
|
### C-like prototypes
|
|
29
29
|
|
|
@@ -36,7 +36,9 @@ const atoi = lib.func('int atoi(str)'); // The parameter name is not used by Kof
|
|
|
36
36
|
|
|
37
37
|
You can use `()` or `(void)` for functions that take no argument.
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Function calls
|
|
40
|
+
|
|
41
|
+
### Calling conventions
|
|
40
42
|
|
|
41
43
|
By default, calling a C function happens synchronously.
|
|
42
44
|
|
|
@@ -57,12 +59,12 @@ Below you can find a small example showing how to use a non-default calling conv
|
|
|
57
59
|
const koffi = require('koffi');
|
|
58
60
|
const lib = koffi.load('user32.dll');
|
|
59
61
|
|
|
60
|
-
// The following two declarations are equivalent, and use
|
|
62
|
+
// The following two declarations are equivalent, and use stdcall on x86 (and the default ABI on other platforms)
|
|
61
63
|
const MessageBoxA_1 = lib.stdcall('MessageBoxA', 'int', ['void *', 'str', 'str', 'uint']);
|
|
62
64
|
const MessageBoxA_2 = lib.func('int __stdcall MessageBoxA(void *hwnd, str text, str caption, uint type)');
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
### Asynchronous calls
|
|
66
68
|
|
|
67
69
|
You can issue asynchronous calls by calling the function through its async member. In this case, you need to provide a callback function as the last argument, with `(err, res)` parameters.
|
|
68
70
|
|
|
@@ -88,7 +90,7 @@ You can easily convert this callback-style async function to a promise-based ver
|
|
|
88
90
|
|
|
89
91
|
Variadic functions cannot be called asynchronously.
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
### Variadic functions
|
|
92
94
|
|
|
93
95
|
Variadic functions are declared with an ellipsis as the last argument.
|
|
94
96
|
|
|
@@ -220,7 +222,7 @@ console.log(ret);
|
|
|
220
222
|
// 42
|
|
221
223
|
```
|
|
222
224
|
|
|
223
|
-
|
|
225
|
+
You need to specify the correct [calling convention](#calling-conventions) on x86 platforms, or the behavior is undefined (Node will probably crash). Only *cdecl* and *stdcall* callbacks are supported.
|
|
224
226
|
|
|
225
227
|
## Thread safety
|
|
226
228
|
|
package/doc/index.rst
CHANGED
|
@@ -14,6 +14,8 @@ Koffi is a **fast and easy-to-use C FFI module for Node.js**, featuring:
|
|
|
14
14
|
|
|
15
15
|
Koffi requires a recent `Node.js <https://nodejs.org/>`_ version with N-API version 8 support, see :ref:`this page<Node.js>` for more information.
|
|
16
16
|
|
|
17
|
+
The source code is available here: https://github.com/Koromix/luigi/ (in the *koffi* subdirectory).
|
|
18
|
+
|
|
17
19
|
Table of contents
|
|
18
20
|
-----------------
|
|
19
21
|
|
package/doc/memory.md
CHANGED
|
@@ -7,7 +7,7 @@ For synchronous/normal calls, Koffi uses two preallocated memory blocks:
|
|
|
7
7
|
- One to construct the C stack and assign registers, subsequently used by the platform-specific assembly code (1 MiB by default)
|
|
8
8
|
- One to allocate strings and big objects/structs (2 MiB by default)
|
|
9
9
|
|
|
10
|
-
Unless very big strings or objects (at least more than one page of memory) are used,
|
|
10
|
+
Unless very big strings or objects (at least more than one page of memory) are used, Koffi does not directly allocate any extra memory during calls or callbacks. However, please note that the JS engine (V8) might.
|
|
11
11
|
|
|
12
12
|
The size (in bytes) of these preallocated blocks can be changed. Use `koffi.config()` to get an object with the settings, and `koffi.config(obj)` to apply new settings.
|
|
13
13
|
|