koffi 2.5.7 → 2.5.9
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 +17 -100
- package/build/{2.5.7/koffi_darwin_arm64 → koffi/darwin_arm64}/koffi.node +0 -0
- package/build/{2.5.7/koffi_darwin_x64 → 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/{2.5.7/koffi_freebsd_x64 → koffi/freebsd_x64}/koffi.node +0 -0
- package/build/koffi/linux_arm32hf/koffi.node +0 -0
- package/build/koffi/linux_arm64/koffi.node +0 -0
- package/build/koffi/linux_ia32/koffi.node +0 -0
- package/build/koffi/linux_riscv64hf64/koffi.node +0 -0
- package/build/{2.5.7/koffi_linux_x64 → koffi/linux_x64}/koffi.node +0 -0
- package/build/koffi/openbsd_ia32/koffi.node +0 -0
- package/build/{2.5.7/koffi_openbsd_x64 → koffi/openbsd_x64}/koffi.node +0 -0
- package/build/koffi/win32_arm64/koffi.node +0 -0
- package/build/{2.5.7/koffi_win32_ia32 → koffi/win32_ia32}/koffi.node +0 -0
- package/build/{2.5.7/koffi_win32_x64 → koffi/win32_x64}/koffi.node +0 -0
- package/doc/conf.py +15 -7
- package/doc/contribute.md +2 -2
- package/doc/index.rst +1 -0
- package/doc/packaging.md +60 -0
- package/doc/pyproject.toml +1 -1
- package/doc/start.md +9 -3
- package/doc/static/custom.css +41 -1
- package/doc/static/node_c.webp +0 -0
- package/doc/static/opensans/LICENSE.txt +202 -0
- package/doc/static/opensans/OpenSans.css +39 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Bold.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Bold.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_BoldItalic.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_BoldItalic.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Italic.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Italic.woff2 +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Regular.woff +0 -0
- package/doc/static/opensans/OpenSans_v17_Latin_Regular.woff2 +0 -0
- package/doc/templates/logo.html +3 -0
- package/package.json +3 -3
- package/src/cnoke/assets/FindCNoke.cmake +16 -0
- package/src/core/libcc/libcc.cc +67 -13
- package/src/core/libcc/libcc.hh +24 -13
- package/src/index.d.ts +4 -0
- package/src/index.js +51 -10
- package/src/koffi/CMakeLists.txt +6 -0
- package/src/koffi/examples/electron-builder/README.md +23 -0
- package/src/koffi/examples/electron-builder/package.json +21 -0
- package/src/koffi/examples/electron-builder/src/app.js +20 -0
- package/src/koffi/examples/electron-builder/src/index.html +143 -0
- package/src/koffi/examples/electron-builder/src/preload.js +5 -0
- package/src/koffi/examples/electron-forge/README.md +25 -0
- package/src/koffi/examples/electron-forge/forge.config.js +43 -0
- package/src/koffi/examples/electron-forge/package.json +37 -0
- package/src/koffi/examples/electron-forge/src/index.css +7 -0
- package/src/koffi/examples/electron-forge/src/index.html +143 -0
- package/src/koffi/examples/electron-forge/src/main.js +52 -0
- package/src/koffi/examples/electron-forge/src/preload.js +5 -0
- package/src/koffi/examples/electron-forge/src/renderer.js +31 -0
- package/src/koffi/examples/electron-forge/webpack.main.config.js +11 -0
- package/src/koffi/examples/electron-forge/webpack.renderer.config.js +13 -0
- package/src/koffi/examples/electron-forge/webpack.rules.js +35 -0
- package/src/koffi/examples/nwjs/README.md +20 -0
- package/src/koffi/examples/nwjs/package.json +11 -0
- package/src/koffi/examples/nwjs/src/index.html +145 -0
- package/src/koffi/examples/nwjs/src/package.json +9 -0
- package/src/koffi/src/ffi.cc +1 -0
- package/build/2.5.7/koffi_freebsd_arm64/koffi.node +0 -0
- package/build/2.5.7/koffi_freebsd_ia32/koffi.node +0 -0
- package/build/2.5.7/koffi_linux_arm32hf/koffi.node +0 -0
- package/build/2.5.7/koffi_linux_arm64/koffi.node +0 -0
- package/build/2.5.7/koffi_linux_ia32/koffi.node +0 -0
- package/build/2.5.7/koffi_linux_riscv64hf64/koffi.node +0 -0
- package/build/2.5.7/koffi_openbsd_ia32/koffi.node +0 -0
- package/build/2.5.7/koffi_win32_arm64/koffi.node +0 -0
- package/doc/favicon.png +0 -0
- /package/build/{2.5.7/koffi_win32_arm64 → koffi/win32_arm64}/koffi.exp +0 -0
- /package/build/{2.5.7/koffi_win32_arm64 → koffi/win32_arm64}/koffi.lib +0 -0
- /package/build/{2.5.7/koffi_win32_ia32 → koffi/win32_ia32}/koffi.exp +0 -0
- /package/build/{2.5.7/koffi_win32_ia32 → koffi/win32_ia32}/koffi.lib +0 -0
- /package/build/{2.5.7/koffi_win32_x64 → koffi/win32_x64}/koffi.exp +0 -0
- /package/build/{2.5.7/koffi_win32_x64 → koffi/win32_x64}/koffi.lib +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,54 +4,51 @@
|
|
|
4
4
|
|
|
5
5
|
### Koffi 2.5
|
|
6
6
|
|
|
7
|
-
#### Koffi 2.5.
|
|
7
|
+
#### Koffi 2.5.9
|
|
8
8
|
|
|
9
9
|
**Main changes:**
|
|
10
10
|
|
|
11
|
+
- Use bundler-friendly static require calls in Koffi
|
|
12
|
+
- Add packaging examples to documentation
|
|
13
|
+
|
|
14
|
+
**Other changes:**
|
|
15
|
+
|
|
16
|
+
- Add missing unload() export to TS file
|
|
17
|
+
- Add export for koffi.types in TS file
|
|
18
|
+
|
|
19
|
+
#### Koffi 2.5.8
|
|
20
|
+
|
|
21
|
+
- Add more search paths for native Koffi modules
|
|
22
|
+
- Add section [about bundling](start.md#bundling-koffi) to documentation
|
|
23
|
+
|
|
24
|
+
#### Koffi 2.5.7
|
|
25
|
+
|
|
11
26
|
- Point package to new repository
|
|
12
27
|
|
|
13
28
|
#### Koffi 2.5.6
|
|
14
29
|
|
|
15
|
-
**Main changes:**
|
|
16
|
-
|
|
17
30
|
- Increase limit of output parameters from 16 to 32
|
|
18
31
|
|
|
19
32
|
#### Koffi 2.5.5
|
|
20
33
|
|
|
21
|
-
**Main changes:**
|
|
22
|
-
|
|
23
34
|
- Support decoding non-char null-terminated arrays
|
|
24
35
|
|
|
25
36
|
#### Koffi 2.5.4
|
|
26
37
|
|
|
27
|
-
**Main changes:**
|
|
28
|
-
|
|
29
38
|
- Fix `koffi.pointer()` not accepting disposable types
|
|
30
|
-
|
|
31
|
-
**Other changes:**
|
|
32
|
-
|
|
33
39
|
- Fix potential issues when making pointers to anonymous types
|
|
34
40
|
|
|
35
41
|
#### Koffi 2.5.3
|
|
36
42
|
|
|
37
|
-
**Main changes:**
|
|
38
|
-
|
|
39
43
|
- Add missing union exports in TS definition file
|
|
40
|
-
|
|
41
|
-
**Other changes:**
|
|
42
|
-
|
|
43
44
|
- Fix some parameter names in TS definition file
|
|
44
45
|
|
|
45
46
|
#### Koffi 2.5.2
|
|
46
47
|
|
|
47
|
-
**Main changes:**
|
|
48
|
-
|
|
49
48
|
- Default initialize unset object/struct members
|
|
50
49
|
|
|
51
50
|
#### Koffi 2.5.1
|
|
52
51
|
|
|
53
|
-
**Main changes:**
|
|
54
|
-
|
|
55
52
|
- Fix crash with some struct types in System V 64 ABI
|
|
56
53
|
- Always use direct passthrough for buffer arguments
|
|
57
54
|
|
|
@@ -70,12 +67,7 @@
|
|
|
70
67
|
|
|
71
68
|
#### Koffi 2.4.2
|
|
72
69
|
|
|
73
|
-
**Main changes:**
|
|
74
|
-
|
|
75
70
|
- Support calling variadic function pointers
|
|
76
|
-
|
|
77
|
-
**Other changes:**
|
|
78
|
-
|
|
79
71
|
- Add documentation for function pointers
|
|
80
72
|
|
|
81
73
|
#### Koffi 2.4.1
|
|
@@ -97,64 +89,43 @@
|
|
|
97
89
|
|
|
98
90
|
#### Koffi 2.3.20
|
|
99
91
|
|
|
100
|
-
**Main fixes:**
|
|
101
|
-
|
|
102
92
|
- Support explicit library unloading with `lib.unload()`
|
|
103
93
|
|
|
104
94
|
#### Koffi 2.3.19
|
|
105
95
|
|
|
106
|
-
**Main fixes:**
|
|
107
|
-
|
|
108
96
|
- Actually allow non-ambiguous [string] values for `void *` arguments
|
|
109
97
|
|
|
110
98
|
#### Koffi 2.3.18
|
|
111
99
|
|
|
112
|
-
**Main fixes:**
|
|
113
|
-
|
|
114
100
|
- Fix possible crash on exit caused by unregistered callbacks
|
|
115
101
|
|
|
116
102
|
#### Koffi 2.3.17
|
|
117
103
|
|
|
118
|
-
**Main changes:**
|
|
119
|
-
|
|
120
104
|
- Allow strings for input `void *`, `int8_t *` and `int16_t *` pointer arguments
|
|
121
105
|
- Support using `[string]` (single-element string arrays) for polymorphic input/output arguments
|
|
122
106
|
|
|
123
107
|
#### Koffi 2.3.16
|
|
124
108
|
|
|
125
|
-
**Main changes:**
|
|
126
|
-
|
|
127
109
|
- Fix Windows ARM64 build to work with official Node.js version
|
|
128
110
|
- Compile Windows builds with Visual Studio 2022 17.5.3
|
|
129
|
-
|
|
130
|
-
**Other changes:**
|
|
131
|
-
|
|
132
111
|
- Support null in `koffi.free()` and `koffi.address()`
|
|
133
112
|
|
|
134
113
|
#### Koffi 2.3.15
|
|
135
114
|
|
|
136
|
-
**Main changes:**
|
|
137
|
-
|
|
138
115
|
- Improve manual decoding of 0-terminated strings
|
|
139
116
|
- Add checks around array conversion hints
|
|
140
117
|
|
|
141
118
|
#### Koffi 2.3.14
|
|
142
119
|
|
|
143
|
-
**Main changes:**
|
|
144
|
-
|
|
145
120
|
- Add `koffi.errno()` function to get and set current errno value
|
|
146
121
|
- Add `koffi.os.errno` object with valid errno codes
|
|
147
122
|
|
|
148
123
|
#### Koffi 2.3.13
|
|
149
124
|
|
|
150
|
-
**Main changes:**
|
|
151
|
-
|
|
152
125
|
- Add `koffi.address()` to get the raw value of a wrapper pointer
|
|
153
126
|
|
|
154
127
|
#### Koffi 2.3.12
|
|
155
128
|
|
|
156
|
-
**Main fixes:**
|
|
157
|
-
|
|
158
129
|
- Fix broken syntax in TS definition file
|
|
159
130
|
- Add missing exported properties in TS file
|
|
160
131
|
|
|
@@ -172,29 +143,21 @@
|
|
|
172
143
|
|
|
173
144
|
#### Koffi 2.3.9
|
|
174
145
|
|
|
175
|
-
**Main changes:**
|
|
176
|
-
|
|
177
146
|
- Relicense under MIT license
|
|
178
147
|
|
|
179
148
|
#### Koffi 2.3.8
|
|
180
149
|
|
|
181
|
-
**Main fixes:**
|
|
182
|
-
|
|
183
150
|
- Disable non-ready union support
|
|
184
151
|
- Simplify Windows stack allocation and drop NOACCESS and GUARD pages
|
|
185
152
|
- Adjust Windows TEB SEH chain and GuaranteedStackBytes for Koffi calls
|
|
186
153
|
|
|
187
154
|
#### Koffi 2.3.7
|
|
188
155
|
|
|
189
|
-
**Main fixes:**
|
|
190
|
-
|
|
191
156
|
- Fix missing require in index.js ([@gastonFrecceroNapse](https://github.com/gastonFrecceroNapse))
|
|
192
157
|
- Reduce NPM package bloat (from 65 MB to 20 MB) caused by changes in 2.3.6
|
|
193
158
|
|
|
194
159
|
#### Koffi 2.3.6
|
|
195
160
|
|
|
196
|
-
**Main changes:**
|
|
197
|
-
|
|
198
161
|
- Fix broken TS definition file
|
|
199
162
|
- Keep all prebuilt binaries and load correct one at runtime
|
|
200
163
|
|
|
@@ -216,8 +179,6 @@
|
|
|
216
179
|
|
|
217
180
|
#### Koffi 2.3.4
|
|
218
181
|
|
|
219
|
-
**Main fixes:**
|
|
220
|
-
|
|
221
182
|
- Fix error when installing Koffi on Windows (2.3.2)
|
|
222
183
|
|
|
223
184
|
#### Koffi 2.3.2
|
|
@@ -235,8 +196,6 @@
|
|
|
235
196
|
|
|
236
197
|
#### Koffi 2.3.1
|
|
237
198
|
|
|
238
|
-
**Main changes:**
|
|
239
|
-
|
|
240
199
|
- Error out when trying to use ambiguous `void *` arguments (input and/or output)
|
|
241
200
|
- Adjust TypeScript definitions ([@insraq](https://github.com/insraq))
|
|
242
201
|
- Fix possible crash when parsing invalid prototype
|
|
@@ -262,28 +221,16 @@
|
|
|
262
221
|
|
|
263
222
|
#### Koffi 2.2.5
|
|
264
223
|
|
|
265
|
-
**Main changes:**
|
|
266
|
-
|
|
267
224
|
- Relicense Koffi under LGPL 3.0
|
|
268
225
|
|
|
269
226
|
#### Koffi 2.2.4
|
|
270
227
|
|
|
271
|
-
**Main fixes:**
|
|
272
|
-
|
|
273
228
|
- Fix memory leak on Windows (in Koffi 2.2.3) when running many async calls
|
|
274
|
-
|
|
275
|
-
**Other changes:**
|
|
276
|
-
|
|
277
229
|
- Reorganize documentation pages
|
|
278
230
|
|
|
279
231
|
#### Koffi 2.2.3
|
|
280
232
|
|
|
281
|
-
**Main fixes:**
|
|
282
|
-
|
|
283
233
|
- Support native code that uses [Structured Exception Handling (SEH)](https://learn.microsoft.com/en-us/cpp/cpp/structured-exception-handling-c-cpp) on Windows (x86, x64 and ARM64)
|
|
284
|
-
|
|
285
|
-
**Other changes:**
|
|
286
|
-
|
|
287
234
|
- Try to use ebp/rbp as frame pointer in x86/x64 ASM code
|
|
288
235
|
|
|
289
236
|
#### Koffi 2.2.2
|
|
@@ -302,8 +249,6 @@
|
|
|
302
249
|
|
|
303
250
|
#### Koffi 2.2.1
|
|
304
251
|
|
|
305
|
-
**Main fixes:**
|
|
306
|
-
|
|
307
252
|
- Fix crash when [calling callback again after FFI call inside previous callback](https://github.com/Koromix/rygel/issues/15)
|
|
308
253
|
|
|
309
254
|
#### Koffi 2.2.0
|
|
@@ -324,8 +269,6 @@
|
|
|
324
269
|
|
|
325
270
|
#### Koffi 2.1.5
|
|
326
271
|
|
|
327
|
-
**Main fixes:**
|
|
328
|
-
|
|
329
272
|
- Add missing README.md file to NPM package
|
|
330
273
|
|
|
331
274
|
#### Koffi 2.1.4
|
|
@@ -341,20 +284,14 @@
|
|
|
341
284
|
|
|
342
285
|
#### Koffi 2.1.3
|
|
343
286
|
|
|
344
|
-
**Main changes:**
|
|
345
|
-
|
|
346
287
|
- Support up to 16 output parameters (instead of 8)
|
|
347
288
|
|
|
348
289
|
#### Koffi 2.1.2
|
|
349
290
|
|
|
350
|
-
**Main changes:**
|
|
351
|
-
|
|
352
291
|
- Support up to 8 output parameters (instead of 4)
|
|
353
292
|
|
|
354
293
|
#### Koffi 2.1.1
|
|
355
294
|
|
|
356
|
-
**Main fixes:**
|
|
357
|
-
|
|
358
295
|
- Fix potential memory allocation bugs
|
|
359
296
|
|
|
360
297
|
#### Koffi 2.1.0
|
|
@@ -379,8 +316,6 @@
|
|
|
379
316
|
|
|
380
317
|
#### Koffi 2.0.1
|
|
381
318
|
|
|
382
|
-
**Main changes:**
|
|
383
|
-
|
|
384
319
|
- Return `undefined` (instead of null) for `void` functions
|
|
385
320
|
|
|
386
321
|
#### Koffi 2.0.0
|
|
@@ -411,14 +346,10 @@ Consult the [migration guide](migration.md) for more information.
|
|
|
411
346
|
|
|
412
347
|
#### Koffi 1.3.12
|
|
413
348
|
|
|
414
|
-
**Main fixes:**
|
|
415
|
-
|
|
416
349
|
- Fix support for Yarn package manager
|
|
417
350
|
|
|
418
351
|
#### Koffi 1.3.11
|
|
419
352
|
|
|
420
|
-
**Main fixes:**
|
|
421
|
-
|
|
422
353
|
- Fix broken parsing of `void *` when used for first parameter
|
|
423
354
|
|
|
424
355
|
#### Koffi 1.3.10
|
|
@@ -435,8 +366,6 @@ Consult the [migration guide](migration.md) for more information.
|
|
|
435
366
|
|
|
436
367
|
#### Koffi 1.3.9
|
|
437
368
|
|
|
438
|
-
**Main fixes:**
|
|
439
|
-
|
|
440
369
|
- Fix prebuild compatibility with Electron on Windows x64
|
|
441
370
|
|
|
442
371
|
#### Koffi 1.3.8
|
|
@@ -489,8 +418,6 @@ Consult the [migration guide](migration.md) for more information.
|
|
|
489
418
|
|
|
490
419
|
#### Koffi 1.3.4
|
|
491
420
|
|
|
492
|
-
**Main fixes:**
|
|
493
|
-
|
|
494
421
|
- Fix possible OpenBSD i386 crash with `(void)` functions
|
|
495
422
|
|
|
496
423
|
#### Koffi 1.3.3
|
|
@@ -507,15 +434,11 @@ Consult the [migration guide](migration.md) for more information.
|
|
|
507
434
|
|
|
508
435
|
#### Koffi 1.3.2
|
|
509
436
|
|
|
510
|
-
**Main fixes:**
|
|
511
|
-
|
|
512
437
|
- Support compilation in C++14 mode (graceful degradation)
|
|
513
438
|
- Support older toolchains on Linux (tested on Debian 9)
|
|
514
439
|
|
|
515
440
|
#### Koffi 1.3.1
|
|
516
441
|
|
|
517
|
-
**Main fixes:**
|
|
518
|
-
|
|
519
442
|
- The prebuilt binary is tested when Koffi is installed, and a rebuild happens if it fails to load
|
|
520
443
|
|
|
521
444
|
#### Koffi 1.3.0
|
|
@@ -538,14 +461,10 @@ Consult the [migration guide](migration.md) for more information.
|
|
|
538
461
|
|
|
539
462
|
#### Koffi 1.2.4
|
|
540
463
|
|
|
541
|
-
**New features:**
|
|
542
|
-
|
|
543
464
|
- Windows ARM64 is now supported
|
|
544
465
|
|
|
545
466
|
#### Koffi 1.2.3
|
|
546
467
|
|
|
547
|
-
**New features:**
|
|
548
|
-
|
|
549
468
|
- A prebuilt binary for macOS ARM64 (M1) is now included
|
|
550
469
|
|
|
551
470
|
#### Koffi 1.2.1
|
|
@@ -577,11 +496,9 @@ This entry documents changes since version 1.1.0.
|
|
|
577
496
|
|
|
578
497
|
The following features and improvements are planned, not necessarily in that order:
|
|
579
498
|
|
|
580
|
-
- Optimize passing of structs and arrays (
|
|
499
|
+
- Optimize passing of structs and arrays (with auto-generated JS)
|
|
581
500
|
- Automate Windows/AArch64 (qemu) and macOS/AArch64 (how? ... thanks Apple) tests
|
|
582
501
|
- Create a real-world example, using several libraries (Raylib, SQLite, libsodium) to illustrate various C API styles
|
|
583
502
|
- Add simple struct type parser
|
|
584
|
-
- Add more ways to manually encode and decode various types to and from byte arrays
|
|
585
|
-
- Add support for unions
|
|
586
503
|
- Port Koffi to PowerPC (POWER9+) ABI
|
|
587
504
|
- Fix assembly unwind and CFI directives for better debugging experience
|
|
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/conf.py
CHANGED
|
@@ -56,22 +56,29 @@ html_static_path = ['static']
|
|
|
56
56
|
|
|
57
57
|
html_theme_options = {
|
|
58
58
|
'light_css_variables': {
|
|
59
|
-
'
|
|
60
|
-
'color-
|
|
59
|
+
'font-stack': 'Open Sans',
|
|
60
|
+
'color-content-foreground': '#383838',
|
|
61
|
+
'color-brand-primary': '#383838',
|
|
62
|
+
'color-brand-content': '#e97713'
|
|
61
63
|
},
|
|
62
64
|
'dark_css_variables': {
|
|
63
|
-
'
|
|
64
|
-
'color-
|
|
65
|
+
'font-stack': 'Open Sans',
|
|
66
|
+
'color-content-foreground': '#ffffffdd',
|
|
67
|
+
'color-brand-primary': '#ffffffdd',
|
|
68
|
+
'color-brand-content': '#e97713'
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
html_link_suffix = ''
|
|
69
73
|
|
|
70
|
-
html_css_files = [
|
|
74
|
+
html_css_files = [
|
|
75
|
+
'opensans/OpenSans.css',
|
|
76
|
+
'custom.css'
|
|
77
|
+
]
|
|
71
78
|
|
|
72
79
|
html_sidebars = {
|
|
73
80
|
"**": [
|
|
74
|
-
"
|
|
81
|
+
"logo.html",
|
|
75
82
|
"sidebar/search.html",
|
|
76
83
|
"sidebar/scroll-start.html",
|
|
77
84
|
"sidebar/navigation.html",
|
|
@@ -105,5 +112,6 @@ myst_number_code_blocks = ['c', 'js', 'sh', 'batch']
|
|
|
105
112
|
# -- Redirections -------------------------------------------------
|
|
106
113
|
|
|
107
114
|
rediraffe_redirects = {
|
|
108
|
-
"changes.md": "changelog.md"
|
|
115
|
+
"changes.md": "changelog.md",
|
|
116
|
+
"bundling.md": "packaging.md"
|
|
109
117
|
}
|
package/doc/contribute.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Bugs and feature requests
|
|
4
4
|
|
|
5
|
-
Use the official repository
|
|
5
|
+
Use the official repository for bugs, ideas and features requests: https://github.com/Koromix/koffi
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Please note that the source code is not in this repository, instead it lives in a monorepo: https://github.com/Koromix/rygel/ (in the *src/koffi* subdirectory).
|
|
8
8
|
|
|
9
9
|
## Build from source
|
|
10
10
|
|
package/doc/index.rst
CHANGED
package/doc/packaging.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Packaging
|
|
2
|
+
|
|
3
|
+
## Bundling and native modules
|
|
4
|
+
|
|
5
|
+
*Simplified in Koffi 2.5.9*
|
|
6
|
+
|
|
7
|
+
Koffi uses native modules to work. The NPM package contains binaries for various platforms and architectures, and the appropriate module is selected at runtime.
|
|
8
|
+
|
|
9
|
+
In theory, the bundlers should be able to find recorgnize all native modules because they are explictly listed in the Javascript file, as static strings.
|
|
10
|
+
|
|
11
|
+
If that is not the case, you can manually arrange to copy the `node_modules/koffi/build/koffi` directory next to your bundled script.
|
|
12
|
+
|
|
13
|
+
Here is an example that would work:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
koffi/
|
|
17
|
+
win32_x64/
|
|
18
|
+
koffi.node
|
|
19
|
+
linux_x64/
|
|
20
|
+
koffi.node
|
|
21
|
+
...
|
|
22
|
+
MyBundle.js
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When running in Electron, Koffi will also try to find the native module in `process.resourcesPath`. For an Electron app you could do something like this
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
locales/
|
|
29
|
+
resources/
|
|
30
|
+
koffi/
|
|
31
|
+
darwin_arm64/
|
|
32
|
+
koffi.node
|
|
33
|
+
darwin_x64/
|
|
34
|
+
koffi.node
|
|
35
|
+
MyApp.exe
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Packaging examples
|
|
39
|
+
|
|
40
|
+
### Electron with electron-builder
|
|
41
|
+
|
|
42
|
+
Packaging with electron-builder should work as-is:
|
|
43
|
+
|
|
44
|
+
You can also go take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-builder).
|
|
45
|
+
|
|
46
|
+
### Electron Forge
|
|
47
|
+
|
|
48
|
+
Packaging with Electron Force should work as-is, even when using webpack as configured initially when you run:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm init electron-app@latest my-app -- --template=webpack
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
You can also go take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-forge).
|
|
55
|
+
|
|
56
|
+
### NW.js
|
|
57
|
+
|
|
58
|
+
Packagers such as nw-builder should work as-is.
|
|
59
|
+
|
|
60
|
+
You can find a full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/nwjs).
|
package/doc/pyproject.toml
CHANGED
package/doc/start.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Get started
|
|
2
2
|
|
|
3
3
|
## Install Koffi
|
|
4
4
|
|
|
@@ -18,12 +18,14 @@ const koffi = require('koffi');
|
|
|
18
18
|
import koffi from 'koffi';
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Simple examples
|
|
22
|
+
|
|
21
23
|
Below you can find three examples:
|
|
22
24
|
|
|
23
25
|
* The first one runs on Linux. The functions are declared with the C-like prototype language.
|
|
24
26
|
* The second one runs on Windows, and uses the node-ffi like syntax to declare functions.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
### For Linux
|
|
27
29
|
|
|
28
30
|
This is a small example for Linux systems, which uses `gettimeofday()`, `localtime_r()` and `printf()` to print the current time.
|
|
29
31
|
|
|
@@ -74,7 +76,7 @@ printf('Hello World!\n');
|
|
|
74
76
|
printf('Local time: %02d:%02d:%02d\n', 'int', now.tm_hour, 'int', now.tm_min, 'int', now.tm_sec);
|
|
75
77
|
```
|
|
76
78
|
|
|
77
|
-
|
|
79
|
+
### For Windows
|
|
78
80
|
|
|
79
81
|
This is a small example targeting the Win32 API, using `MessageBox()` to show a *Hello World!* message to the user.
|
|
80
82
|
|
|
@@ -104,3 +106,7 @@ let ret = MessageBoxA(null, 'Do you want another message box?', 'Koffi', MB_YESN
|
|
|
104
106
|
if (ret == IDYES)
|
|
105
107
|
MessageBoxW(null, 'Hello World!', 'Koffi', MB_ICONINFORMATION);
|
|
106
108
|
```
|
|
109
|
+
|
|
110
|
+
## Bundling Koffi
|
|
111
|
+
|
|
112
|
+
Please read the [dedicated page](packaging.md) for information about bundling and packaging applications using Koffi.
|
package/doc/static/custom.css
CHANGED
|
@@ -23,8 +23,48 @@ aside.footnote {
|
|
|
23
23
|
display: flex;
|
|
24
24
|
margin-top: 6px;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
aside.footnote > p {
|
|
28
27
|
margin: 0;
|
|
29
28
|
margin-left: 1rem;
|
|
30
29
|
}
|
|
30
|
+
|
|
31
|
+
.toctree-l1 > a {
|
|
32
|
+
font-size: 1.1em;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
h1 {
|
|
36
|
+
font-size: 2rem;
|
|
37
|
+
text-transform: uppercase;
|
|
38
|
+
font-weight: normal;
|
|
39
|
+
margin-bottom: 1.2rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
h2 {
|
|
43
|
+
display: table;
|
|
44
|
+
margin-left: 0;
|
|
45
|
+
margin-bottom: 1.2rem;
|
|
46
|
+
padding: 3px 12px 3px 30px;
|
|
47
|
+
background: var(--color-brand-primary) !important;
|
|
48
|
+
border-right: 32px solid var(--color-background-primary);
|
|
49
|
+
border-radius: 0;
|
|
50
|
+
font-size: 1.6rem;
|
|
51
|
+
font-weight: normal;
|
|
52
|
+
text-transform: uppercase;
|
|
53
|
+
color: var(--color-background-primary) !important;
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
h2 > a {
|
|
57
|
+
filter: none !important;
|
|
58
|
+
position: absolute;
|
|
59
|
+
left: calc(100% - 32px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
h3 {
|
|
63
|
+
font-size: 1.4rem;
|
|
64
|
+
font-weight: normal;
|
|
65
|
+
margin-bottom: 1.2rem;
|
|
66
|
+
font-style: italic;
|
|
67
|
+
padding-left: 50px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:target > h1, :target > h3 { background: none !important; }
|
|
Binary file
|