koffi 2.5.8 → 2.5.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +15 -99
  2. package/build/{2.5.8 → koffi}/darwin_arm64/koffi.node +0 -0
  3. package/build/{2.5.8 → koffi}/darwin_x64/koffi.node +0 -0
  4. package/build/{2.5.8 → koffi}/freebsd_arm64/koffi.node +0 -0
  5. package/build/{2.5.8 → koffi}/freebsd_ia32/koffi.node +0 -0
  6. package/build/{2.5.8 → koffi}/freebsd_x64/koffi.node +0 -0
  7. package/build/koffi/linux_arm32hf/koffi.node +0 -0
  8. package/build/{2.5.8 → koffi}/linux_arm64/koffi.node +0 -0
  9. package/build/{2.5.8 → koffi}/linux_ia32/koffi.node +0 -0
  10. package/build/{2.5.8 → koffi}/linux_riscv64hf64/koffi.node +0 -0
  11. package/build/{2.5.8 → koffi}/linux_x64/koffi.node +0 -0
  12. package/build/koffi/openbsd_ia32/koffi.node +0 -0
  13. package/build/{2.5.8 → koffi}/openbsd_x64/koffi.node +0 -0
  14. package/build/{2.5.8 → koffi}/win32_arm64/koffi.node +0 -0
  15. package/build/{2.5.8 → koffi}/win32_ia32/koffi.node +0 -0
  16. package/build/{2.5.8 → koffi}/win32_x64/koffi.node +0 -0
  17. package/doc/conf.py +2 -1
  18. package/doc/index.rst +1 -0
  19. package/doc/packaging.md +71 -0
  20. package/doc/start.md +1 -36
  21. package/package.json +2 -2
  22. package/src/cnoke/assets/FindCNoke.cmake +16 -0
  23. package/src/core/libcc/libcc.cc +13 -9
  24. package/src/core/libcc/libcc.hh +2 -1
  25. package/src/index.d.ts +4 -0
  26. package/src/index.js +53 -24
  27. package/src/koffi/CMakeLists.txt +10 -0
  28. package/src/koffi/examples/electron-builder/README.md +11 -0
  29. package/src/koffi/examples/electron-builder/package.json +21 -0
  30. package/src/koffi/examples/electron-builder/src/app.js +20 -0
  31. package/src/koffi/examples/electron-builder/src/index.html +143 -0
  32. package/src/koffi/examples/electron-builder/src/preload.js +5 -0
  33. package/src/koffi/examples/electron-forge/README.md +25 -0
  34. package/src/koffi/examples/electron-forge/forge.config.js +43 -0
  35. package/src/koffi/examples/electron-forge/package.json +37 -0
  36. package/src/koffi/examples/electron-forge/src/index.css +7 -0
  37. package/src/koffi/examples/electron-forge/src/index.html +143 -0
  38. package/src/koffi/examples/electron-forge/src/main.js +52 -0
  39. package/src/koffi/examples/electron-forge/src/preload.js +5 -0
  40. package/src/koffi/examples/electron-forge/src/renderer.js +31 -0
  41. package/src/koffi/examples/electron-forge/webpack.main.config.js +11 -0
  42. package/src/koffi/examples/electron-forge/webpack.renderer.config.js +13 -0
  43. package/src/koffi/examples/electron-forge/webpack.rules.js +35 -0
  44. package/src/koffi/examples/node-esbuild/README.md +19 -0
  45. package/src/koffi/examples/node-esbuild/index.js +2 -0
  46. package/src/koffi/examples/node-esbuild/package.json +16 -0
  47. package/src/koffi/examples/nwjs/README.md +20 -0
  48. package/src/koffi/examples/nwjs/package.json +11 -0
  49. package/src/koffi/examples/nwjs/src/index.html +145 -0
  50. package/src/koffi/examples/nwjs/src/package.json +10 -0
  51. package/src/koffi/src/ffi.cc +1 -0
  52. package/build/2.5.8/linux_arm32hf/koffi.node +0 -0
  53. package/build/2.5.8/openbsd_ia32/koffi.node +0 -0
  54. /package/build/{2.5.8 → koffi}/win32_arm64/koffi.exp +0 -0
  55. /package/build/{2.5.8 → koffi}/win32_arm64/koffi.lib +0 -0
  56. /package/build/{2.5.8 → koffi}/win32_ia32/koffi.exp +0 -0
  57. /package/build/{2.5.8 → koffi}/win32_ia32/koffi.lib +0 -0
  58. /package/build/{2.5.8 → koffi}/win32_x64/koffi.exp +0 -0
  59. /package/build/{2.5.8 → koffi}/win32_x64/koffi.lib +0 -0
package/CHANGELOG.md CHANGED
@@ -4,61 +4,55 @@
4
4
 
5
5
  ### Koffi 2.5
6
6
 
7
- #### Koffi 2.5.8
7
+ #### Koffi 2.5.10
8
+
9
+ - Fix CMake regression when client has to build Koffi
10
+
11
+ #### Koffi 2.5.9
8
12
 
9
13
  **Main changes:**
10
14
 
15
+ - Use bundler-friendly static require calls in Koffi
16
+ - Add packaging examples to documentation
17
+
18
+ **Other changes:**
19
+
20
+ - Add missing unload() export to TS file
21
+ - Add export for koffi.types in TS file
22
+
23
+ #### Koffi 2.5.8
24
+
11
25
  - Add more search paths for native Koffi modules
12
26
  - Add section [about bundling](start.md#bundling-koffi) to documentation
13
27
 
14
28
  #### Koffi 2.5.7
15
29
 
16
- **Main changes:**
17
-
18
30
  - Point package to new repository
19
31
 
20
32
  #### Koffi 2.5.6
21
33
 
22
- **Main changes:**
23
-
24
34
  - Increase limit of output parameters from 16 to 32
25
35
 
26
36
  #### Koffi 2.5.5
27
37
 
28
- **Main changes:**
29
-
30
38
  - Support decoding non-char null-terminated arrays
31
39
 
32
40
  #### Koffi 2.5.4
33
41
 
34
- **Main changes:**
35
-
36
42
  - Fix `koffi.pointer()` not accepting disposable types
37
-
38
- **Other changes:**
39
-
40
43
  - Fix potential issues when making pointers to anonymous types
41
44
 
42
45
  #### Koffi 2.5.3
43
46
 
44
- **Main changes:**
45
-
46
47
  - Add missing union exports in TS definition file
47
-
48
- **Other changes:**
49
-
50
48
  - Fix some parameter names in TS definition file
51
49
 
52
50
  #### Koffi 2.5.2
53
51
 
54
- **Main changes:**
55
-
56
52
  - Default initialize unset object/struct members
57
53
 
58
54
  #### Koffi 2.5.1
59
55
 
60
- **Main changes:**
61
-
62
56
  - Fix crash with some struct types in System V 64 ABI
63
57
  - Always use direct passthrough for buffer arguments
64
58
 
@@ -77,12 +71,7 @@
77
71
 
78
72
  #### Koffi 2.4.2
79
73
 
80
- **Main changes:**
81
-
82
74
  - Support calling variadic function pointers
83
-
84
- **Other changes:**
85
-
86
75
  - Add documentation for function pointers
87
76
 
88
77
  #### Koffi 2.4.1
@@ -104,64 +93,43 @@
104
93
 
105
94
  #### Koffi 2.3.20
106
95
 
107
- **Main fixes:**
108
-
109
96
  - Support explicit library unloading with `lib.unload()`
110
97
 
111
98
  #### Koffi 2.3.19
112
99
 
113
- **Main fixes:**
114
-
115
100
  - Actually allow non-ambiguous [string] values for `void *` arguments
116
101
 
117
102
  #### Koffi 2.3.18
118
103
 
119
- **Main fixes:**
120
-
121
104
  - Fix possible crash on exit caused by unregistered callbacks
122
105
 
123
106
  #### Koffi 2.3.17
124
107
 
125
- **Main changes:**
126
-
127
108
  - Allow strings for input `void *`, `int8_t *` and `int16_t *` pointer arguments
128
109
  - Support using `[string]` (single-element string arrays) for polymorphic input/output arguments
129
110
 
130
111
  #### Koffi 2.3.16
131
112
 
132
- **Main changes:**
133
-
134
113
  - Fix Windows ARM64 build to work with official Node.js version
135
114
  - Compile Windows builds with Visual Studio 2022 17.5.3
136
-
137
- **Other changes:**
138
-
139
115
  - Support null in `koffi.free()` and `koffi.address()`
140
116
 
141
117
  #### Koffi 2.3.15
142
118
 
143
- **Main changes:**
144
-
145
119
  - Improve manual decoding of 0-terminated strings
146
120
  - Add checks around array conversion hints
147
121
 
148
122
  #### Koffi 2.3.14
149
123
 
150
- **Main changes:**
151
-
152
124
  - Add `koffi.errno()` function to get and set current errno value
153
125
  - Add `koffi.os.errno` object with valid errno codes
154
126
 
155
127
  #### Koffi 2.3.13
156
128
 
157
- **Main changes:**
158
-
159
129
  - Add `koffi.address()` to get the raw value of a wrapper pointer
160
130
 
161
131
  #### Koffi 2.3.12
162
132
 
163
- **Main fixes:**
164
-
165
133
  - Fix broken syntax in TS definition file
166
134
  - Add missing exported properties in TS file
167
135
 
@@ -179,29 +147,21 @@
179
147
 
180
148
  #### Koffi 2.3.9
181
149
 
182
- **Main changes:**
183
-
184
150
  - Relicense under MIT license
185
151
 
186
152
  #### Koffi 2.3.8
187
153
 
188
- **Main fixes:**
189
-
190
154
  - Disable non-ready union support
191
155
  - Simplify Windows stack allocation and drop NOACCESS and GUARD pages
192
156
  - Adjust Windows TEB SEH chain and GuaranteedStackBytes for Koffi calls
193
157
 
194
158
  #### Koffi 2.3.7
195
159
 
196
- **Main fixes:**
197
-
198
160
  - Fix missing require in index.js ([@gastonFrecceroNapse](https://github.com/gastonFrecceroNapse))
199
161
  - Reduce NPM package bloat (from 65 MB to 20 MB) caused by changes in 2.3.6
200
162
 
201
163
  #### Koffi 2.3.6
202
164
 
203
- **Main changes:**
204
-
205
165
  - Fix broken TS definition file
206
166
  - Keep all prebuilt binaries and load correct one at runtime
207
167
 
@@ -223,8 +183,6 @@
223
183
 
224
184
  #### Koffi 2.3.4
225
185
 
226
- **Main fixes:**
227
-
228
186
  - Fix error when installing Koffi on Windows (2.3.2)
229
187
 
230
188
  #### Koffi 2.3.2
@@ -242,8 +200,6 @@
242
200
 
243
201
  #### Koffi 2.3.1
244
202
 
245
- **Main changes:**
246
-
247
203
  - Error out when trying to use ambiguous `void *` arguments (input and/or output)
248
204
  - Adjust TypeScript definitions ([@insraq](https://github.com/insraq))
249
205
  - Fix possible crash when parsing invalid prototype
@@ -269,28 +225,16 @@
269
225
 
270
226
  #### Koffi 2.2.5
271
227
 
272
- **Main changes:**
273
-
274
228
  - Relicense Koffi under LGPL 3.0
275
229
 
276
230
  #### Koffi 2.2.4
277
231
 
278
- **Main fixes:**
279
-
280
232
  - Fix memory leak on Windows (in Koffi 2.2.3) when running many async calls
281
-
282
- **Other changes:**
283
-
284
233
  - Reorganize documentation pages
285
234
 
286
235
  #### Koffi 2.2.3
287
236
 
288
- **Main fixes:**
289
-
290
237
  - 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)
291
-
292
- **Other changes:**
293
-
294
238
  - Try to use ebp/rbp as frame pointer in x86/x64 ASM code
295
239
 
296
240
  #### Koffi 2.2.2
@@ -309,8 +253,6 @@
309
253
 
310
254
  #### Koffi 2.2.1
311
255
 
312
- **Main fixes:**
313
-
314
256
  - Fix crash when [calling callback again after FFI call inside previous callback](https://github.com/Koromix/rygel/issues/15)
315
257
 
316
258
  #### Koffi 2.2.0
@@ -331,8 +273,6 @@
331
273
 
332
274
  #### Koffi 2.1.5
333
275
 
334
- **Main fixes:**
335
-
336
276
  - Add missing README.md file to NPM package
337
277
 
338
278
  #### Koffi 2.1.4
@@ -348,20 +288,14 @@
348
288
 
349
289
  #### Koffi 2.1.3
350
290
 
351
- **Main changes:**
352
-
353
291
  - Support up to 16 output parameters (instead of 8)
354
292
 
355
293
  #### Koffi 2.1.2
356
294
 
357
- **Main changes:**
358
-
359
295
  - Support up to 8 output parameters (instead of 4)
360
296
 
361
297
  #### Koffi 2.1.1
362
298
 
363
- **Main fixes:**
364
-
365
299
  - Fix potential memory allocation bugs
366
300
 
367
301
  #### Koffi 2.1.0
@@ -386,8 +320,6 @@
386
320
 
387
321
  #### Koffi 2.0.1
388
322
 
389
- **Main changes:**
390
-
391
323
  - Return `undefined` (instead of null) for `void` functions
392
324
 
393
325
  #### Koffi 2.0.0
@@ -418,14 +350,10 @@ Consult the [migration guide](migration.md) for more information.
418
350
 
419
351
  #### Koffi 1.3.12
420
352
 
421
- **Main fixes:**
422
-
423
353
  - Fix support for Yarn package manager
424
354
 
425
355
  #### Koffi 1.3.11
426
356
 
427
- **Main fixes:**
428
-
429
357
  - Fix broken parsing of `void *` when used for first parameter
430
358
 
431
359
  #### Koffi 1.3.10
@@ -442,8 +370,6 @@ Consult the [migration guide](migration.md) for more information.
442
370
 
443
371
  #### Koffi 1.3.9
444
372
 
445
- **Main fixes:**
446
-
447
373
  - Fix prebuild compatibility with Electron on Windows x64
448
374
 
449
375
  #### Koffi 1.3.8
@@ -496,8 +422,6 @@ Consult the [migration guide](migration.md) for more information.
496
422
 
497
423
  #### Koffi 1.3.4
498
424
 
499
- **Main fixes:**
500
-
501
425
  - Fix possible OpenBSD i386 crash with `(void)` functions
502
426
 
503
427
  #### Koffi 1.3.3
@@ -514,15 +438,11 @@ Consult the [migration guide](migration.md) for more information.
514
438
 
515
439
  #### Koffi 1.3.2
516
440
 
517
- **Main fixes:**
518
-
519
441
  - Support compilation in C++14 mode (graceful degradation)
520
442
  - Support older toolchains on Linux (tested on Debian 9)
521
443
 
522
444
  #### Koffi 1.3.1
523
445
 
524
- **Main fixes:**
525
-
526
446
  - The prebuilt binary is tested when Koffi is installed, and a rebuild happens if it fails to load
527
447
 
528
448
  #### Koffi 1.3.0
@@ -545,14 +465,10 @@ Consult the [migration guide](migration.md) for more information.
545
465
 
546
466
  #### Koffi 1.2.4
547
467
 
548
- **New features:**
549
-
550
468
  - Windows ARM64 is now supported
551
469
 
552
470
  #### Koffi 1.2.3
553
471
 
554
- **New features:**
555
-
556
472
  - A prebuilt binary for macOS ARM64 (M1) is now included
557
473
 
558
474
  #### Koffi 1.2.1
package/doc/conf.py CHANGED
@@ -112,5 +112,6 @@ myst_number_code_blocks = ['c', 'js', 'sh', 'batch']
112
112
  # -- Redirections -------------------------------------------------
113
113
 
114
114
  rediraffe_redirects = {
115
- "changes.md": "changelog.md"
115
+ "changes.md": "changelog.md",
116
+ "bundling.md": "packaging.md"
116
117
  }
package/doc/index.rst CHANGED
@@ -30,6 +30,7 @@ Table of contents
30
30
  parameters
31
31
  callbacks
32
32
  misc
33
+ packaging
33
34
  benchmarks
34
35
  contribute
35
36
  changelog
@@ -0,0 +1,71 @@
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 **packagers/bundlers should be able to find all native modules** because they are explictly listed in the Javascript file (as static strings) and package them somehow.
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
+ win32_ia32/
32
+ koffi.node
33
+ win32_x64/
34
+ koffi.node
35
+ ...
36
+ MyApp.exe
37
+ ```
38
+
39
+ ## Packaging examples
40
+
41
+ ### Electron with electron-builder
42
+
43
+ Packaging with electron-builder should work as-is.
44
+
45
+ Take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-builder).
46
+
47
+ ### Electron Forge
48
+
49
+ Packaging with Electron Force should work as-is, even when using webpack as configured initially when you run:
50
+
51
+ ```sh
52
+ npm init electron-app@latest my-app -- --template=webpack
53
+ ```
54
+
55
+ Take a look at the full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/electron-forge).
56
+
57
+ ### NW.js
58
+
59
+ Packagers such as nw-builder should work as-is.
60
+
61
+ You can find a full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/nwjs).
62
+
63
+ ### Node.js and esbuild
64
+
65
+ You can easily tell esbuild to copy the native files with the copy loader and things should just work. Use something like:
66
+
67
+ ```sh
68
+ esbuild index.js --platform=node --bundle --loader:.node=copy --outdir=dist/
69
+ ```
70
+
71
+ You can find a full [working example in the repository](https://github.com/Koromix/rygel/tree/master/src/koffi/examples/node-esbuild).
package/doc/start.md CHANGED
@@ -109,39 +109,4 @@ if (ret == IDYES)
109
109
 
110
110
  ## Bundling Koffi
111
111
 
112
- *Improved in Koffi 2.5.8*
113
-
114
- Koffi uses native modules to work. The NPM package contains binaries for various platforms and architectures, and the appropriate module is selected at runtime.
115
-
116
- If you use a bundler, you must make sure that the {{ "`node_modules/koffi/build/" ~ stable ~ "`" }} directory is available in your bundled script.
117
-
118
- Here is an example that would work:
119
-
120
- ```{eval-rst}
121
- .. parsed-literal::
122
- koffi/
123
- |version|/
124
- win32_x64/
125
- koffi.node
126
- linux_x64/
127
- koffi.node
128
- ...
129
- MyBundle.js
130
- ```
131
-
132
- 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
133
-
134
- ```{eval-rst}
135
- .. parsed-literal::
136
- locales/
137
- resources/
138
- koffi/
139
- |version|/
140
- darwin_arm64/
141
- koffi.node
142
- darwin_x64/
143
- koffi.node
144
- MyApp.exe
145
- ```
146
-
147
- You must configure your bundler and/or your packager to make this work.
112
+ Please read the [dedicated page](packaging.md) for information about bundling and packaging applications using Koffi.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.5.8",
4
- "stable": "2.5.8",
3
+ "version": "2.5.10",
4
+ "stable": "2.5.10",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -48,8 +48,12 @@ if(USE_UNITY_BUILDS)
48
48
  set(unity_file_cpp "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_unity.cpp")
49
49
  file(REMOVE ${unity_file_c} ${unity_file_cpp})
50
50
 
51
+ set(c_definitions "")
52
+ set(cpp_definitions "")
53
+
51
54
  foreach(src ${sources})
52
55
  get_source_file_property(language ${src} LANGUAGE)
56
+ get_property(definitions SOURCE ${src} PROPERTY COMPILE_DEFINITIONS)
53
57
  if(IS_ABSOLUTE ${src})
54
58
  set(src_full ${src})
55
59
  else()
@@ -58,17 +62,29 @@ if(USE_UNITY_BUILDS)
58
62
  if(language STREQUAL "C")
59
63
  set_source_files_properties(${src} PROPERTIES HEADER_FILE_ONLY 1)
60
64
  file(APPEND ${unity_file_c} "#include \"${src_full}\"\n")
65
+ if (definitions)
66
+ set(c_definitions "${c_definitions} ${definitions}")
67
+ endif()
61
68
  elseif(language STREQUAL "CXX")
62
69
  set_source_files_properties(${src} PROPERTIES HEADER_FILE_ONLY 1)
63
70
  file(APPEND ${unity_file_cpp} "#include \"${src_full}\"\n")
71
+ if (definitions)
72
+ set(cpp_definitions "${cpp_definitions} ${definitions}")
73
+ endif()
64
74
  endif()
65
75
  endforeach()
66
76
 
67
77
  if(EXISTS ${unity_file_c})
68
78
  target_sources(${TARGET} PRIVATE ${unity_file_c})
79
+ if(c_definitions)
80
+ set_source_files_properties(${unity_file_c} PROPERTIES COMPILE_DEFINITIONS ${c_definitions})
81
+ endif()
69
82
  endif()
70
83
  if(EXISTS ${unity_file_cpp})
71
84
  target_sources(${TARGET} PRIVATE ${unity_file_cpp})
85
+ if(cpp_definitions)
86
+ set_source_files_properties(${unity_file_cpp} PROPERTIES COMPILE_DEFINITIONS ${cpp_definitions})
87
+ endif()
72
88
  endif()
73
89
 
74
90
  target_compile_definitions(${TARGET} PRIVATE -DUNITY_BUILD=1)
@@ -4832,7 +4832,8 @@ const char *GetTemporaryDirectory()
4832
4832
 
4833
4833
  #endif
4834
4834
 
4835
- const char *FindConfigFile(const char *name, Allocator *alloc, LocalArray<const char *, 4> *out_possibilities)
4835
+ const char *FindConfigFile(Span<const char *const> names, Allocator *alloc,
4836
+ LocalArray<const char *, 4> *out_possibilities)
4836
4837
  {
4837
4838
  decltype(GetUserConfigPath) *funcs[] = {
4838
4839
  [](const char *name, Allocator *alloc) {
@@ -4850,16 +4851,19 @@ const char *FindConfigFile(const char *name, Allocator *alloc, LocalArray<const
4850
4851
  const char *filename = nullptr;
4851
4852
 
4852
4853
  for (const auto &func: funcs) {
4853
- const char *path = func(name, alloc);
4854
+ for (const char *name: names) {
4855
+ const char *path = func(name, alloc);
4854
4856
 
4855
- if (!path)
4856
- continue;
4857
+ if (!path)
4858
+ continue;
4857
4859
 
4858
- if (TestFile(path, FileType::File)) {
4859
- filename = path;
4860
- }
4861
- if (out_possibilities) {
4862
- out_possibilities->Append(path);
4860
+ if (TestFile(path, FileType::File)) {
4861
+ filename = path;
4862
+ }
4863
+ if (out_possibilities) {
4864
+ out_possibilities->Append(path);
4865
+ break;
4866
+ }
4863
4867
  }
4864
4868
  }
4865
4869
 
@@ -4114,7 +4114,8 @@ const char *GetUserCachePath(const char *name, Allocator *alloc); // Can return
4114
4114
  const char *GetSystemConfigPath(const char *name, Allocator *alloc);
4115
4115
  const char *GetTemporaryDirectory();
4116
4116
 
4117
- const char *FindConfigFile(const char *name, Allocator *alloc, LocalArray<const char *, 4> *out_possibilities = nullptr);
4117
+ const char *FindConfigFile(Span<const char *const> names, Allocator *alloc,
4118
+ LocalArray<const char *, 4> *out_possibilities = nullptr);
4118
4119
 
4119
4120
  const char *CreateUniqueFile(Span<const char> directory, const char *prefix, const char *extension,
4120
4121
  Allocator *alloc, FILE **out_fp = nullptr);
package/src/index.d.ts CHANGED
@@ -79,6 +79,8 @@ declare module 'koffi' {
79
79
 
80
80
  thiscall(definition: string): KoffiFunction;
81
81
  thiscall(name: string, result: TypeSpec, arguments: TypeSpec[]): KoffiFunction;
82
+
83
+ unload(): void;
82
84
  }
83
85
 
84
86
  export function struct(name: string, def: Record<string, TypeSpecWithAlignment>): IKoffiCType;
@@ -149,4 +151,6 @@ declare module 'koffi' {
149
151
  export const os: {
150
152
  errno: Record<string, number>
151
153
  };
154
+
155
+ export const types: Record<string, IKoffiCType>;
152
156
  }