koffi 2.8.5 → 2.8.6
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 +4 -0
- package/README.md +6 -0
- 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_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/koffi/linux_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/contribute.md +3 -2
- package/doc/functions.md +3 -2
- package/doc/start.md +9 -1
- package/index.js +2 -2
- package/indirect.js +2 -2
- package/package.json +2 -2
- package/src/koffi/CMakeLists.txt +5 -1
- package/src/koffi/src/ffi.cc +3 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -29,6 +29,12 @@ You can consult the [changelog](https://koffi.dev/changelog) on the official web
|
|
|
29
29
|
|
|
30
30
|
Major version increments can include breaking API changes, use the [migration guide](https://koffi.dev/changelog#migration-guide) for more information.
|
|
31
31
|
|
|
32
|
+
# Build manually
|
|
33
|
+
|
|
34
|
+
Koffi is built with a custom CMake-wrapper called CNoke, which also lives in this repository. Don't try to run CMake manually because it will fail.
|
|
35
|
+
|
|
36
|
+
Follow the [documented build instructions](https://koffi.dev/contribute#build-from-source) to build Koffi from source.
|
|
37
|
+
|
|
32
38
|
# License
|
|
33
39
|
|
|
34
40
|
This program is free software: you can redistribute it and/or modify it under the terms of the **MIT License**.
|
|
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/contribute.md
CHANGED
|
@@ -25,7 +25,7 @@ First, make sure the following dependencies are met:
|
|
|
25
25
|
|
|
26
26
|
- The "Desktop development with C++" workload from [Visual Studio 2022 or 2019](https://visualstudio.microsoft.com/downloads/) or the "C++ build tools" workload from the [Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022), with the default optional components.
|
|
27
27
|
- [CMake meta build system](https://cmake.org/)
|
|
28
|
-
- [Node.js](https://nodejs.org/)
|
|
28
|
+
- [Node.js](https://nodejs.org/) 16 or later
|
|
29
29
|
|
|
30
30
|
Once this is done, run this command _from the test or the benchmark directory_ (depending on what you want to build):
|
|
31
31
|
|
|
@@ -41,7 +41,7 @@ Make sure the following dependencies are met:
|
|
|
41
41
|
- `gcc` and `g++` >= 8.3 or newer
|
|
42
42
|
- GNU Make 3.81 or newer
|
|
43
43
|
- [CMake meta build system](https://cmake.org/)
|
|
44
|
-
- [Node.js](https://nodejs.org/)
|
|
44
|
+
- [Node.js](https://nodejs.org/) 16 or later
|
|
45
45
|
|
|
46
46
|
Once this is done, run this command _from the test or the benchmark directory_ (depending on what you want to build):
|
|
47
47
|
|
|
@@ -64,6 +64,7 @@ node sync.js # Run synchronous unit tests
|
|
|
64
64
|
node async.js # Run asynchronous unit tests
|
|
65
65
|
node callbacks.js # Run callback unit tests
|
|
66
66
|
node union.js # Run union unit tests
|
|
67
|
+
node posix.js # Run POSIX-specific unit tests (not for Windows)
|
|
67
68
|
node win32.js # Run Windows-specific unit tests (only on Windows)
|
|
68
69
|
|
|
69
70
|
node sqlite.js # Run SQLite integration tests
|
package/doc/functions.md
CHANGED
|
@@ -21,14 +21,15 @@ On some platforms (such as with the [musl C library on Linux](https://wiki.musl-
|
|
|
21
21
|
|
|
22
22
|
## Loading options
|
|
23
23
|
|
|
24
|
-
*New in Koffi 2.6 and Koffi 2.8.
|
|
24
|
+
*New in Koffi 2.6, changed in Koffi 2.8.2 and Koffi 2.8.6*
|
|
25
25
|
|
|
26
26
|
The `load` function can take an optional object argument, with the following options:
|
|
27
27
|
|
|
28
28
|
```js
|
|
29
29
|
const options = {
|
|
30
30
|
lazy: true, // Use RTLD_LAZY (lazy-binding) on POSIX platforms (by default, use RTLD_NOW)
|
|
31
|
-
global: true // Use RTLD_GLOBAL on POSIX platforms (by default, use RTLD_LOCAL)
|
|
31
|
+
global: true, // Use RTLD_GLOBAL on POSIX platforms (by default, use RTLD_LOCAL)
|
|
32
|
+
deep: true // Use RTLD_DEEPBIND if supported (Linux, FreeBSD)
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const lib = koffi.load('/path/to/shared/library.so', options);
|
package/doc/start.md
CHANGED
|
@@ -109,4 +109,12 @@ if (ret == IDYES)
|
|
|
109
109
|
|
|
110
110
|
## Bundling Koffi
|
|
111
111
|
|
|
112
|
-
Please read the [dedicated page](packaging.md) for information about bundling and packaging applications using Koffi.
|
|
112
|
+
Please read the [dedicated page](packaging.md) for information about bundling and packaging applications using Koffi.
|
|
113
|
+
|
|
114
|
+
## Build manually
|
|
115
|
+
|
|
116
|
+
Follow the [build instrutions](contribute.md#build-from-source) if you want to build the native Koffi code yourself.
|
|
117
|
+
|
|
118
|
+
```{note}
|
|
119
|
+
This is only needed if you want to hack on Koffi. The official NPM package provide prebuilt binaries and you don't need to compile anything if you only want to use Koffi in Node.js.
|
|
120
|
+
```
|
package/index.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.8.
|
|
382
|
-
stable: "2.8.
|
|
381
|
+
version: "2.8.6",
|
|
382
|
+
stable: "2.8.6",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/indirect.js
CHANGED
|
@@ -378,8 +378,8 @@ var require_package = __commonJS({
|
|
|
378
378
|
"build/dist/src/koffi/package.json"(exports2, module2) {
|
|
379
379
|
module2.exports = {
|
|
380
380
|
name: "koffi",
|
|
381
|
-
version: "2.8.
|
|
382
|
-
stable: "2.8.
|
|
381
|
+
version: "2.8.6",
|
|
382
|
+
stable: "2.8.6",
|
|
383
383
|
description: "Fast and simple C FFI (foreign function interface) for Node.js",
|
|
384
384
|
keywords: [
|
|
385
385
|
"foreign",
|
package/package.json
CHANGED
package/src/koffi/CMakeLists.txt
CHANGED
|
@@ -21,8 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
cmake_minimum_required(VERSION 3.6)
|
|
23
23
|
cmake_policy(SET CMP0091 NEW)
|
|
24
|
-
project(koffi C CXX ASM)
|
|
25
24
|
|
|
25
|
+
if(NOT NODE_JS_INCLUDE_DIRS)
|
|
26
|
+
message(FATAL_ERROR "Please use CNoke to build Koffi, follow instructions here: https://koffi.dev/contribute#build-from-source")
|
|
27
|
+
endif()
|
|
28
|
+
|
|
29
|
+
project(koffi C CXX ASM)
|
|
26
30
|
find_package(CNoke)
|
|
27
31
|
|
|
28
32
|
include(CheckCXXCompilerFlag)
|
package/src/koffi/src/ffi.cc
CHANGED
|
@@ -1737,6 +1737,9 @@ static Napi::Value LoadSharedLibrary(const Napi::CallbackInfo &info)
|
|
|
1737
1737
|
|
|
1738
1738
|
flags |= options.Get("lazy").ToBoolean() ? RTLD_LAZY : RTLD_NOW;
|
|
1739
1739
|
flags |= options.Get("global").ToBoolean() ? RTLD_GLOBAL : RTLD_LOCAL;
|
|
1740
|
+
#ifdef RTLD_DEEPBIND
|
|
1741
|
+
flags |= options.Get("deep").ToBoolean() ? RTLD_DEEPBIND : 0;
|
|
1742
|
+
#endif
|
|
1740
1743
|
} else {
|
|
1741
1744
|
flags = RTLD_NOW | RTLD_LOCAL;
|
|
1742
1745
|
}
|