koffi 1.0.0 → 1.0.3
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/CMakeLists.txt +12 -11
- package/README.md +19 -17
- package/build/qemu/1.0.3/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_linux_arm.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.0.3/koffi_win32_x64.tar.gz +0 -0
- package/package.json +8 -4
- package/qemu/qemu.js +794 -0
- package/qemu/registry/machines.json +415 -0
- package/qemu/registry/sha256sum.txt +45 -0
- package/src/{call_arm32.cc → abi_arm32.cc} +76 -50
- package/src/{call_arm32_fwd.S → abi_arm32_fwd.S} +0 -0
- package/src/{call_arm64.cc → abi_arm64.cc} +79 -51
- package/src/{call_arm64_fwd.S → abi_arm64_fwd.S} +0 -0
- package/src/{call_x64_sysv.cc → abi_x64_sysv.cc} +77 -49
- package/src/{call_x64_sysv_fwd.S → abi_x64_sysv_fwd.S} +0 -0
- package/src/{call_x64_win.cc → abi_x64_win.cc} +71 -47
- package/src/{call_x64_win_fwd.asm → abi_x64_win_fwd.asm} +0 -0
- package/src/{call_x86.cc → abi_x86.cc} +74 -56
- package/src/{call_x86_fwd.S → abi_x86_fwd.S} +0 -0
- package/src/{call_x86_fwd.asm → abi_x86_fwd.asm} +0 -0
- package/src/call.cc +228 -0
- package/src/call.hh +96 -4
- package/src/ffi.cc +8 -3
- package/src/ffi.hh +2 -0
- package/src/util.cc +11 -157
- package/src/util.hh +0 -91
- package/test/CMakeLists.txt +1 -0
- package/test/misc.c +289 -0
- package/test/misc.def +3 -0
- package/test/misc.js +180 -0
- package/test/raylib.js +165 -0
- package/test/sqlite.js +104 -0
- package/build/qemu/1.0.0/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_linux_arm.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.0.0/koffi_win32_x64.tar.gz +0 -0
package/CMakeLists.txt
CHANGED
|
@@ -24,11 +24,12 @@ endif()
|
|
|
24
24
|
# ---- Koffi ----
|
|
25
25
|
|
|
26
26
|
set(KOFFI_SRC
|
|
27
|
-
src/
|
|
28
|
-
src/
|
|
29
|
-
src/
|
|
30
|
-
src/
|
|
31
|
-
src/
|
|
27
|
+
src/call.cc
|
|
28
|
+
src/abi_arm32.cc
|
|
29
|
+
src/abi_arm64.cc
|
|
30
|
+
src/abi_x64_sysv.cc
|
|
31
|
+
src/abi_x64_win.cc
|
|
32
|
+
src/abi_x86.cc
|
|
32
33
|
src/ffi.cc
|
|
33
34
|
src/parser.cc
|
|
34
35
|
src/util.cc
|
|
@@ -36,19 +37,19 @@ set(KOFFI_SRC
|
|
|
36
37
|
)
|
|
37
38
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
38
39
|
if(WIN32)
|
|
39
|
-
list(APPEND KOFFI_SRC src/
|
|
40
|
+
list(APPEND KOFFI_SRC src/abi_x64_win_fwd.asm)
|
|
40
41
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
|
|
41
|
-
list(APPEND KOFFI_SRC src/
|
|
42
|
+
list(APPEND KOFFI_SRC src/abi_arm64_fwd.S)
|
|
42
43
|
else()
|
|
43
|
-
list(APPEND KOFFI_SRC src/
|
|
44
|
+
list(APPEND KOFFI_SRC src/abi_x64_sysv_fwd.S)
|
|
44
45
|
endif()
|
|
45
46
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
46
47
|
if(WIN32)
|
|
47
|
-
list(APPEND KOFFI_SRC src/
|
|
48
|
+
list(APPEND KOFFI_SRC src/abi_x86_fwd.asm)
|
|
48
49
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i[3456]86|x86|AMD64")
|
|
49
|
-
list(APPEND KOFFI_SRC src/
|
|
50
|
+
list(APPEND KOFFI_SRC src/abi_x86_fwd.S)
|
|
50
51
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv[678]l")
|
|
51
|
-
list(APPEND KOFFI_SRC src/
|
|
52
|
+
list(APPEND KOFFI_SRC src/abi_arm32_fwd.S)
|
|
52
53
|
endif()
|
|
53
54
|
endif()
|
|
54
55
|
|
package/README.md
CHANGED
|
@@ -23,21 +23,23 @@ The following platforms __are officially supported and tested__ at the moment:
|
|
|
23
23
|
|
|
24
24
|
Platoform | Architecture | JS to C | C to JS (callback) | Pre-built binary
|
|
25
25
|
--------- | -------------------------------- | ------- | ------------------ | ----------------
|
|
26
|
-
Windows | x86 (cdecl, stdcall, fastcall) | 🟩 | 🟥 | Yes
|
|
27
|
-
Windows | x86_64 | 🟩 | 🟥 | Yes
|
|
28
|
-
Linux | x86 | 🟩 | 🟥 | Yes
|
|
29
|
-
Linux | x86_64 | 🟩 | 🟥 | Yes
|
|
30
|
-
Linux | ARM32+VFP Little Endian | 🟩 | 🟥 | Yes
|
|
31
|
-
Linux | ARM64 Little Endian | 🟩 | 🟥 | Yes
|
|
32
|
-
FreeBSD | x86 | 🟩 | 🟥 | Yes
|
|
33
|
-
FreeBSD | x86_64 | 🟩 | 🟥 | Yes
|
|
34
|
-
FreeBSD | ARM64 Little Endian | 🟩 | 🟥 | Yes
|
|
35
|
-
macOS | x86_64 | 🟩 | 🟥 | Yes
|
|
36
|
-
macOS | ARM64 (M1) Little Endian | 🟩 | 🟥 | No
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
OpenBSD |
|
|
40
|
-
|
|
26
|
+
Windows | x86 (cdecl, stdcall, fastcall) | 🟩 | 🟥 | ✅ Yes
|
|
27
|
+
Windows | x86_64 | 🟩 | 🟥 | ✅ Yes
|
|
28
|
+
Linux | x86 | 🟩 | 🟥 | ✅ Yes
|
|
29
|
+
Linux | x86_64 | 🟩 | 🟥 | ✅ Yes
|
|
30
|
+
Linux | ARM32+VFP Little Endian | 🟩 | 🟥 | ✅ Yes
|
|
31
|
+
Linux | ARM64 Little Endian | 🟩 | 🟥 | ✅ Yes
|
|
32
|
+
FreeBSD | x86 | 🟩 | 🟥 | ✅ Yes
|
|
33
|
+
FreeBSD | x86_64 | 🟩 | 🟥 | ✅ Yes
|
|
34
|
+
FreeBSD | ARM64 Little Endian | 🟩 | 🟥 | ✅ Yes
|
|
35
|
+
macOS | x86_64 | 🟩 | 🟥 | ✅ Yes
|
|
36
|
+
macOS | ARM64 (M1) Little Endian | 🟩 | 🟥 | ❌ No
|
|
37
|
+
OpenBSD | x86_64 | 🟧 | 🟥 | ❌ No
|
|
38
|
+
OpenBSD | x86 | 🟧 | 🟥 | ❌ No
|
|
39
|
+
OpenBSD | ARM64 Little Endian | 🟧 | 🟥 | ❌ No
|
|
40
|
+
NetBSD | x86_64 | 🟧 | 🟥 | ❌ No
|
|
41
|
+
NetBSD | x86 | 🟧 | 🟥 | ❌ No
|
|
42
|
+
NetBSD | ARM64 Little Endian | 🟧 | 🟥 | ❌ No
|
|
41
43
|
|
|
42
44
|
🟩 Tested, fully operational
|
|
43
45
|
🟧 May work, but not actively tested
|
|
@@ -53,7 +55,7 @@ Once you have installed koffi with `npm install koffi`, you can start by loading
|
|
|
53
55
|
const koffi = require('koffi');
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
Below you can find
|
|
58
|
+
Below you can find three examples:
|
|
57
59
|
|
|
58
60
|
* The first one runs on Linux. The functions are declared with the C-like prototype language.
|
|
59
61
|
* The second one runs on Windows, and uses the node-ffi like syntax to declare functions.
|
|
@@ -101,7 +103,7 @@ MessageBoxA(null, 'Hello', 'Foobar', MB_ICONINFORMATION);
|
|
|
101
103
|
|
|
102
104
|
## Raylib example
|
|
103
105
|
|
|
104
|
-
This section assumes you know how to build C shared libraries, such as Raylib. You may need to fix the
|
|
106
|
+
This section assumes you know how to build C shared libraries, such as Raylib. You may need to fix the path to the library before you can do anything.
|
|
105
107
|
|
|
106
108
|
```js
|
|
107
109
|
const koffi = require('koffi');
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koffi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Fast and simple FFI (foreign function interface) for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foreign",
|
|
@@ -40,10 +40,14 @@
|
|
|
40
40
|
"benchmark/CMakeLists.txt",
|
|
41
41
|
"benchmark/atoi_*",
|
|
42
42
|
"benchmark/raylib_*",
|
|
43
|
+
"qemu/qemu.js",
|
|
44
|
+
"qemu/registry",
|
|
43
45
|
"test/CMakeLists.txt",
|
|
44
|
-
"test/
|
|
45
|
-
"test/
|
|
46
|
-
"test/
|
|
46
|
+
"test/misc.c",
|
|
47
|
+
"test/misc.def",
|
|
48
|
+
"test/misc.js",
|
|
49
|
+
"test/raylib.js",
|
|
50
|
+
"test/sqlite.js",
|
|
47
51
|
"vendor",
|
|
48
52
|
"LICENSE.txt",
|
|
49
53
|
"README.md",
|