koffi 1.3.9 → 1.3.12

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.
Files changed (92) hide show
  1. package/ChangeLog.md +24 -0
  2. package/build/qemu/1.3.12/koffi_darwin_arm64.tar.gz +0 -0
  3. package/build/qemu/1.3.12/koffi_darwin_x64.tar.gz +0 -0
  4. package/build/qemu/1.3.12/koffi_freebsd_arm64.tar.gz +0 -0
  5. package/build/qemu/1.3.12/koffi_freebsd_ia32.tar.gz +0 -0
  6. package/build/qemu/1.3.12/koffi_freebsd_x64.tar.gz +0 -0
  7. package/build/qemu/1.3.12/koffi_linux_arm32hf.tar.gz +0 -0
  8. package/build/qemu/1.3.12/koffi_linux_arm64.tar.gz +0 -0
  9. package/build/qemu/1.3.12/koffi_linux_ia32.tar.gz +0 -0
  10. package/build/qemu/1.3.12/koffi_linux_riscv64hf64.tar.gz +0 -0
  11. package/build/qemu/1.3.12/koffi_linux_x64.tar.gz +0 -0
  12. package/build/qemu/1.3.12/koffi_openbsd_ia32.tar.gz +0 -0
  13. package/build/qemu/1.3.12/koffi_openbsd_x64.tar.gz +0 -0
  14. package/build/qemu/1.3.12/koffi_win32_arm64.tar.gz +0 -0
  15. package/build/qemu/1.3.12/koffi_win32_ia32.tar.gz +0 -0
  16. package/build/qemu/1.3.12/koffi_win32_x64.tar.gz +0 -0
  17. package/doc/benchmarks.md +2 -2
  18. package/doc/conf.py +1 -1
  19. package/doc/contribute.md +1 -1
  20. package/doc/dist/doctrees/benchmarks.doctree +0 -0
  21. package/doc/dist/doctrees/changes.doctree +0 -0
  22. package/doc/dist/doctrees/contribute.doctree +0 -0
  23. package/doc/dist/doctrees/environment.pickle +0 -0
  24. package/doc/dist/doctrees/functions.doctree +0 -0
  25. package/doc/dist/doctrees/index.doctree +0 -0
  26. package/doc/dist/doctrees/memory.doctree +0 -0
  27. package/doc/dist/doctrees/types.doctree +0 -0
  28. package/doc/dist/html/.buildinfo +1 -1
  29. package/doc/dist/html/_sources/benchmarks.md.txt +2 -2
  30. package/doc/dist/html/_sources/contribute.md.txt +1 -2
  31. package/doc/dist/html/_sources/functions.md.txt +137 -15
  32. package/doc/dist/html/_sources/index.rst.txt +2 -0
  33. package/doc/dist/html/_sources/memory.md.txt +1 -1
  34. package/doc/dist/html/_sources/types.md.txt +27 -11
  35. package/doc/dist/html/_static/basic.css +14 -12
  36. package/doc/dist/html/_static/pygments.css +54 -54
  37. package/doc/dist/html/benchmarks.html +3 -3
  38. package/doc/dist/html/changes.html +1 -1
  39. package/doc/dist/html/contribute.html +2 -3
  40. package/doc/dist/html/functions.html +206 -86
  41. package/doc/dist/html/genindex.html +1 -1
  42. package/doc/dist/html/index.html +6 -7
  43. package/doc/dist/html/memory.html +4 -4
  44. package/doc/dist/html/objects.inv +0 -0
  45. package/doc/dist/html/platforms.html +2 -2
  46. package/doc/dist/html/search.html +1 -1
  47. package/doc/dist/html/searchindex.js +1 -1
  48. package/doc/dist/html/start.html +55 -55
  49. package/doc/dist/html/types.html +172 -159
  50. package/doc/functions.md +9 -7
  51. package/doc/index.rst +2 -0
  52. package/doc/memory.md +1 -1
  53. package/doc/poetry.lock +692 -0
  54. package/doc/pyproject.toml +18 -0
  55. package/doc/{_static → static}/bench_linux.png +0 -0
  56. package/doc/{_static → static}/bench_windows.png +0 -0
  57. package/doc/{_static → static}/custom.css +0 -0
  58. package/doc/{_static → static}/perf_linux_20220623.png +0 -0
  59. package/doc/{_static → static}/perf_linux_20220623_2.png +0 -0
  60. package/doc/{_static → static}/perf_linux_20220627.png +0 -0
  61. package/doc/{_static → static}/perf_linux_20220628.png +0 -0
  62. package/doc/{_static → static}/perf_windows_20220623.png +0 -0
  63. package/doc/{_static → static}/perf_windows_20220623_2.png +0 -0
  64. package/doc/{_static → static}/perf_windows_20220627.png +0 -0
  65. package/doc/{_static → static}/perf_windows_20220628.png +0 -0
  66. package/doc/types.md +1 -1
  67. package/package.json +9 -7
  68. package/qemu/qemu.js +3 -3
  69. package/src/abi_arm32.cc +3 -3
  70. package/src/abi_riscv64.cc +1 -1
  71. package/src/abi_x64_sysv.cc +1 -1
  72. package/src/abi_x64_win.cc +1 -1
  73. package/src/abi_x64_win_fwd.asm +2 -2
  74. package/src/abi_x86.cc +5 -5
  75. package/src/parser.cc +2 -1
  76. package/test/misc.c +1 -1
  77. package/test/sync.js +2 -2
  78. package/build/qemu/1.3.9/koffi_darwin_arm64.tar.gz +0 -0
  79. package/build/qemu/1.3.9/koffi_darwin_x64.tar.gz +0 -0
  80. package/build/qemu/1.3.9/koffi_freebsd_arm64.tar.gz +0 -0
  81. package/build/qemu/1.3.9/koffi_freebsd_ia32.tar.gz +0 -0
  82. package/build/qemu/1.3.9/koffi_freebsd_x64.tar.gz +0 -0
  83. package/build/qemu/1.3.9/koffi_linux_arm32hf.tar.gz +0 -0
  84. package/build/qemu/1.3.9/koffi_linux_arm64.tar.gz +0 -0
  85. package/build/qemu/1.3.9/koffi_linux_ia32.tar.gz +0 -0
  86. package/build/qemu/1.3.9/koffi_linux_riscv64hf64.tar.gz +0 -0
  87. package/build/qemu/1.3.9/koffi_linux_x64.tar.gz +0 -0
  88. package/build/qemu/1.3.9/koffi_openbsd_ia32.tar.gz +0 -0
  89. package/build/qemu/1.3.9/koffi_openbsd_x64.tar.gz +0 -0
  90. package/build/qemu/1.3.9/koffi_win32_arm64.tar.gz +0 -0
  91. package/build/qemu/1.3.9/koffi_win32_ia32.tar.gz +0 -0
  92. package/build/qemu/1.3.9/koffi_win32_x64.tar.gz +0 -0
package/doc/functions.md CHANGED
@@ -1,4 +1,4 @@
1
- # Function calls
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 [on standard calls](#synchronous-calls) for more information on this subject.
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
- ## Synchronous calls
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 Stdcall
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
- ## Asynchronous calls
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
- ## Variadic functions
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
- On x86 platforms, only Cdecl and Stdcall callbacks are supported.
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, no extra allocation ever happens during calls or callbacks.
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