koffi 1.2.4 → 1.3.1
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/README.md +7 -489
- package/benchmark/CMakeLists.txt +13 -9
- package/benchmark/raylib_node_raylib.js +67 -0
- package/build/qemu/1.3.1/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_linux_arm32hf.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_linux_riscv64hf64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.3.1/koffi_win32_x64.tar.gz +0 -0
- package/doc/Makefile +20 -0
- package/doc/_static/bench_linux.png +0 -0
- package/doc/_static/bench_windows.png +0 -0
- package/doc/_static/custom.css +22 -0
- package/doc/benchmarks.md +113 -0
- package/doc/benchmarks.xlsx +0 -0
- package/doc/conf.py +54 -0
- package/doc/contribute.md +115 -0
- package/doc/dist/doctrees/benchmarks.doctree +0 -0
- package/doc/dist/doctrees/contribute.doctree +0 -0
- package/doc/dist/doctrees/environment.pickle +0 -0
- package/doc/dist/doctrees/functions.doctree +0 -0
- package/doc/dist/doctrees/index.doctree +0 -0
- package/doc/dist/doctrees/memory.doctree +0 -0
- package/doc/dist/doctrees/platforms.doctree +0 -0
- package/doc/dist/doctrees/start.doctree +0 -0
- package/doc/dist/doctrees/types.doctree +0 -0
- package/doc/dist/html/.buildinfo +4 -0
- package/doc/dist/html/_sources/benchmarks.md.txt +113 -0
- package/doc/dist/html/_sources/contribute.md.txt +115 -0
- package/doc/dist/html/_sources/functions.md.txt +224 -0
- package/doc/dist/html/_sources/index.rst.txt +33 -0
- package/doc/dist/html/_sources/memory.md.txt +29 -0
- package/doc/dist/html/_sources/platforms.md.txt +17 -0
- package/doc/dist/html/_sources/start.md.txt +89 -0
- package/doc/dist/html/_sources/types.md.txt +514 -0
- package/doc/dist/html/_static/_sphinx_javascript_frameworks_compat.js +134 -0
- package/doc/dist/html/_static/basic.css +932 -0
- package/doc/dist/html/_static/bench_linux.png +0 -0
- package/doc/dist/html/_static/bench_windows.png +0 -0
- package/doc/dist/html/_static/custom.css +22 -0
- package/doc/dist/html/_static/debug.css +69 -0
- package/doc/dist/html/_static/doctools.js +264 -0
- package/doc/dist/html/_static/documentation_options.js +14 -0
- package/doc/dist/html/_static/file.png +0 -0
- package/doc/dist/html/_static/jquery-3.6.0.js +10881 -0
- package/doc/dist/html/_static/jquery.js +2 -0
- package/doc/dist/html/_static/language_data.js +199 -0
- package/doc/dist/html/_static/minus.png +0 -0
- package/doc/dist/html/_static/plus.png +0 -0
- package/doc/dist/html/_static/pygments.css +252 -0
- package/doc/dist/html/_static/scripts/furo-extensions.js +0 -0
- package/doc/dist/html/_static/scripts/furo.js +3 -0
- package/doc/dist/html/_static/scripts/furo.js.LICENSE.txt +7 -0
- package/doc/dist/html/_static/scripts/furo.js.map +1 -0
- package/doc/dist/html/_static/searchtools.js +531 -0
- package/doc/dist/html/_static/skeleton.css +296 -0
- package/doc/dist/html/_static/styles/furo-extensions.css +2 -0
- package/doc/dist/html/_static/styles/furo-extensions.css.map +1 -0
- package/doc/dist/html/_static/styles/furo.css +2 -0
- package/doc/dist/html/_static/styles/furo.css.map +1 -0
- package/doc/dist/html/_static/underscore-1.13.1.js +2042 -0
- package/doc/dist/html/_static/underscore.js +6 -0
- package/doc/dist/html/benchmarks.html +547 -0
- package/doc/dist/html/contribute.html +382 -0
- package/doc/dist/html/functions.html +530 -0
- package/doc/dist/html/genindex.html +249 -0
- package/doc/dist/html/index.html +342 -0
- package/doc/dist/html/memory.html +337 -0
- package/doc/dist/html/objects.inv +0 -0
- package/doc/dist/html/platforms.html +332 -0
- package/doc/dist/html/search.html +257 -0
- package/doc/dist/html/searchindex.js +1 -0
- package/doc/dist/html/start.html +367 -0
- package/doc/dist/html/types.html +1001 -0
- package/doc/functions.md +224 -0
- package/doc/index.rst +33 -0
- package/doc/make.bat +35 -0
- package/doc/memory.md +29 -0
- package/doc/platforms.md +17 -0
- package/doc/start.md +89 -0
- package/doc/types.md +514 -0
- package/package.json +6 -3
- package/qemu/qemu.js +41 -27
- package/qemu/registry/machines.json +59 -79
- package/qemu/registry/sha256sum.txt +4 -4
- package/src/abi_arm32.cc +20 -48
- package/src/abi_arm64.cc +18 -46
- package/src/abi_arm64_fwd.S +5 -0
- package/src/abi_riscv64.cc +19 -47
- package/src/abi_x64_sysv.cc +18 -46
- package/src/abi_x64_win.cc +19 -47
- package/src/abi_x86.cc +21 -49
- package/src/call.cc +505 -242
- package/src/call.hh +14 -7
- package/src/ffi.cc +50 -27
- package/src/ffi.hh +1 -1
- package/src/parser.cc +2 -20
- package/src/util.cc +50 -11
- package/src/util.hh +2 -0
- package/test/misc.c +31 -0
- package/test/sync.js +41 -4
- package/benchmark/atoi_cc.cc +0 -59
- package/build/qemu/1.2.4/koffi_darwin_arm64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_darwin_x64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_freebsd_arm64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_freebsd_ia32.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_freebsd_x64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_linux_arm.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_linux_arm64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_linux_ia32.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_linux_riscv64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_linux_x64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_openbsd_ia32.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_openbsd_x64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_win32_arm64.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_win32_ia32.tar.gz +0 -0
- package/build/qemu/1.2.4/koffi_win32_x64.tar.gz +0 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="no-js" lang="en">
|
|
3
|
+
<head><meta charset="utf-8"/>
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
5
|
+
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
|
6
|
+
<link rel="index" title="Index" href="genindex" /><link rel="search" title="Search" href="search" /><link rel="prev" title="Benchmarks" href="benchmarks" />
|
|
7
|
+
|
|
8
|
+
<meta name="generator" content="sphinx-5.0.1, furo 2022.06.04.1"/>
|
|
9
|
+
<title>Contributing - Koffi</title>
|
|
10
|
+
<link rel="stylesheet" type="text/css" href="_static/pygments.css" />
|
|
11
|
+
<link rel="stylesheet" type="text/css" href="_static/styles/furo.css?digest=40978830699223671f4072448e654b5958f38b89" />
|
|
12
|
+
<link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?digest=30d1aed668e5c3a91c3e3bf6a60b675221979f0e" />
|
|
13
|
+
<link rel="stylesheet" type="text/css" href="_static/custom.css" />
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
body {
|
|
20
|
+
--color-code-background: #f8f8f8;
|
|
21
|
+
--color-code-foreground: black;
|
|
22
|
+
--color-brand-primary: #FF6600;
|
|
23
|
+
--color-brand-content: #FF6600;
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
@media not print {
|
|
27
|
+
body[data-theme="dark"] {
|
|
28
|
+
--color-code-background: #202020;
|
|
29
|
+
--color-code-foreground: #d0d0d0;
|
|
30
|
+
--color-brand-primary: #FF6600;
|
|
31
|
+
--color-brand-content: #FF6600;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
@media (prefers-color-scheme: dark) {
|
|
35
|
+
body:not([data-theme="light"]) {
|
|
36
|
+
--color-code-background: #202020;
|
|
37
|
+
--color-code-foreground: #d0d0d0;
|
|
38
|
+
--color-brand-primary: #FF6600;
|
|
39
|
+
--color-brand-content: #FF6600;
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
</style></head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
|
53
|
+
<symbol id="svg-toc" viewBox="0 0 24 24">
|
|
54
|
+
<title>Contents</title>
|
|
55
|
+
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
|
|
56
|
+
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
|
|
57
|
+
</svg>
|
|
58
|
+
</symbol>
|
|
59
|
+
<symbol id="svg-menu" viewBox="0 0 24 24">
|
|
60
|
+
<title>Menu</title>
|
|
61
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
62
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
|
|
63
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
64
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
65
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
66
|
+
</svg>
|
|
67
|
+
</symbol>
|
|
68
|
+
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
|
|
69
|
+
<title>Expand</title>
|
|
70
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
71
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
|
|
72
|
+
<polyline points="9 18 15 12 9 6"></polyline>
|
|
73
|
+
</svg>
|
|
74
|
+
</symbol>
|
|
75
|
+
<symbol id="svg-sun" viewBox="0 0 24 24">
|
|
76
|
+
<title>Light mode</title>
|
|
77
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
78
|
+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
|
|
79
|
+
<circle cx="12" cy="12" r="5"></circle>
|
|
80
|
+
<line x1="12" y1="1" x2="12" y2="3"></line>
|
|
81
|
+
<line x1="12" y1="21" x2="12" y2="23"></line>
|
|
82
|
+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
|
|
83
|
+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
|
|
84
|
+
<line x1="1" y1="12" x2="3" y2="12"></line>
|
|
85
|
+
<line x1="21" y1="12" x2="23" y2="12"></line>
|
|
86
|
+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
|
|
87
|
+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
|
|
88
|
+
</svg>
|
|
89
|
+
</symbol>
|
|
90
|
+
<symbol id="svg-moon" viewBox="0 0 24 24">
|
|
91
|
+
<title>Dark mode</title>
|
|
92
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
93
|
+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
|
|
94
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
95
|
+
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
|
|
96
|
+
</svg>
|
|
97
|
+
</symbol>
|
|
98
|
+
<symbol id="svg-sun-half" viewBox="0 0 24 24">
|
|
99
|
+
<title>Auto light/dark mode</title>
|
|
100
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
101
|
+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
|
|
102
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
103
|
+
<circle cx="12" cy="12" r="9" />
|
|
104
|
+
<path d="M13 12h5" />
|
|
105
|
+
<path d="M13 15h4" />
|
|
106
|
+
<path d="M13 18h1" />
|
|
107
|
+
<path d="M13 9h4" />
|
|
108
|
+
<path d="M13 6h1" />
|
|
109
|
+
</svg>
|
|
110
|
+
</symbol>
|
|
111
|
+
</svg>
|
|
112
|
+
|
|
113
|
+
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
|
|
114
|
+
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
|
|
115
|
+
<label class="overlay sidebar-overlay" for="__navigation">
|
|
116
|
+
<div class="visually-hidden">Hide navigation sidebar</div>
|
|
117
|
+
</label>
|
|
118
|
+
<label class="overlay toc-overlay" for="__toc">
|
|
119
|
+
<div class="visually-hidden">Hide table of contents sidebar</div>
|
|
120
|
+
</label>
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
<div class="page">
|
|
125
|
+
<header class="mobile-header">
|
|
126
|
+
<div class="header-left">
|
|
127
|
+
<label class="nav-overlay-icon" for="__navigation">
|
|
128
|
+
<div class="visually-hidden">Toggle site navigation sidebar</div>
|
|
129
|
+
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
|
|
130
|
+
</label>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="header-center">
|
|
133
|
+
<a href="index"><div class="brand">Koffi</div></a>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="header-right">
|
|
136
|
+
<div class="theme-toggle-container theme-toggle-header">
|
|
137
|
+
<button class="theme-toggle">
|
|
138
|
+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
|
|
139
|
+
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
|
|
140
|
+
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
|
|
141
|
+
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
|
|
142
|
+
</button>
|
|
143
|
+
</div>
|
|
144
|
+
<label class="toc-overlay-icon toc-header-icon" for="__toc">
|
|
145
|
+
<div class="visually-hidden">Toggle table of contents sidebar</div>
|
|
146
|
+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
|
|
147
|
+
</label>
|
|
148
|
+
</div>
|
|
149
|
+
</header>
|
|
150
|
+
<aside class="sidebar-drawer">
|
|
151
|
+
<div class="sidebar-container">
|
|
152
|
+
|
|
153
|
+
<div class="sidebar-sticky"><a class="sidebar-brand" href="index">
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
<span class="sidebar-brand-text">Koffi</span>
|
|
157
|
+
|
|
158
|
+
</a><form class="sidebar-search-container" method="get" action="search" role="search">
|
|
159
|
+
<input class="sidebar-search" placeholder=Search name="q" aria-label="Search">
|
|
160
|
+
<input type="hidden" name="check_keywords" value="yes">
|
|
161
|
+
<input type="hidden" name="area" value="default">
|
|
162
|
+
</form>
|
|
163
|
+
<div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
|
|
164
|
+
<ul class="current">
|
|
165
|
+
<li class="toctree-l1"><a class="reference internal" href="platforms">Supported platforms</a></li>
|
|
166
|
+
<li class="toctree-l1"><a class="reference internal" href="start">Quick start</a></li>
|
|
167
|
+
<li class="toctree-l1"><a class="reference internal" href="types">Data types</a></li>
|
|
168
|
+
<li class="toctree-l1"><a class="reference internal" href="functions">Function calls</a></li>
|
|
169
|
+
<li class="toctree-l1"><a class="reference internal" href="memory">Memory usage</a></li>
|
|
170
|
+
<li class="toctree-l1"><a class="reference internal" href="benchmarks">Benchmarks</a></li>
|
|
171
|
+
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Contributing</a></li>
|
|
172
|
+
</ul>
|
|
173
|
+
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
</div>
|
|
180
|
+
</aside>
|
|
181
|
+
<div class="main">
|
|
182
|
+
<div class="content">
|
|
183
|
+
<div class="article-container">
|
|
184
|
+
<a href="#" class="back-to-top muted-link">
|
|
185
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
186
|
+
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
|
|
187
|
+
</svg>
|
|
188
|
+
<span>Back to top</span>
|
|
189
|
+
</a>
|
|
190
|
+
<div class="content-icon-container">
|
|
191
|
+
<div class="theme-toggle-container theme-toggle-content">
|
|
192
|
+
<button class="theme-toggle">
|
|
193
|
+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
|
|
194
|
+
<svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
|
|
195
|
+
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
|
|
196
|
+
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
|
|
197
|
+
</button>
|
|
198
|
+
</div>
|
|
199
|
+
<label class="toc-overlay-icon toc-content-icon" for="__toc">
|
|
200
|
+
<div class="visually-hidden">Toggle table of contents sidebar</div>
|
|
201
|
+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
|
|
202
|
+
</label>
|
|
203
|
+
</div>
|
|
204
|
+
<article role="main">
|
|
205
|
+
<section id="contributing">
|
|
206
|
+
<h1>Contributing<a class="headerlink" href="#contributing" title="Permalink to this heading">#</a></h1>
|
|
207
|
+
<section id="bugs-and-feature-requests">
|
|
208
|
+
<h2>Bugs and feature requests<a class="headerlink" href="#bugs-and-feature-requests" title="Permalink to this heading">#</a></h2>
|
|
209
|
+
<p>Use the official repository (named Luigi, because this is a monorepo containing multiple projects) for bugs, ideas and features requests.</p>
|
|
210
|
+
<p>Go here: <a class="reference external" href="https://github.com/Koromix/luigi/issues">https://github.com/Koromix/luigi/issues</a></p>
|
|
211
|
+
</section>
|
|
212
|
+
<section id="build-from-source">
|
|
213
|
+
<h2>Build from source<a class="headerlink" href="#build-from-source" title="Permalink to this heading">#</a></h2>
|
|
214
|
+
<p>We provide prebuilt binaries, packaged in the NPM archive, so in most cases it should be as simple as <code class="docutils literal notranslate"><span class="pre">npm</span> <span class="pre">install</span> <span class="pre">koffi</span></code>. If you want to hack Koffi or use a specific platform, follow the instructions below.</p>
|
|
215
|
+
<section id="windows">
|
|
216
|
+
<h3>Windows<a class="headerlink" href="#windows" title="Permalink to this heading">#</a></h3>
|
|
217
|
+
<p>First, make sure the following dependencies are met:</p>
|
|
218
|
+
<ul class="simple">
|
|
219
|
+
<li><p>The “Desktop development with C++” workload from <a class="reference external" href="https://visualstudio.microsoft.com/downloads/">Visual Studio 2022 or 2019</a> or the “C++ build tools” workload from the <a class="reference external" href="https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022">Build Tools</a>, with the default optional components.</p></li>
|
|
220
|
+
<li><p><a class="reference external" href="https://cmake.org/">CMake meta build system</a></p></li>
|
|
221
|
+
<li><p><a class="reference external" href="https://nodejs.org/">Node.js</a> 12 or later</p></li>
|
|
222
|
+
</ul>
|
|
223
|
+
<p>Once this is done, run this command <em>from the test or the benchmark directory</em> (depending on what you want to build):</p>
|
|
224
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> koffi/test <span class="c1"># or cd koffi/benchmark</span>
|
|
225
|
+
node ../../cnoke/cnoke.js
|
|
226
|
+
</pre></div>
|
|
227
|
+
</div>
|
|
228
|
+
</section>
|
|
229
|
+
<section id="other-platforms">
|
|
230
|
+
<h3>Other platforms<a class="headerlink" href="#other-platforms" title="Permalink to this heading">#</a></h3>
|
|
231
|
+
<p>Make sure the following dependencies are met:</p>
|
|
232
|
+
<ul class="simple">
|
|
233
|
+
<li><p><code class="docutils literal notranslate"><span class="pre">gcc</span></code> and <code class="docutils literal notranslate"><span class="pre">g++</span></code> >= 8.3 or newer</p></li>
|
|
234
|
+
<li><p>GNU Make 3.81 or newer</p></li>
|
|
235
|
+
<li><p><a class="reference external" href="https://cmake.org/">CMake meta build system</a></p></li>
|
|
236
|
+
<li><p><a class="reference external" href="https://nodejs.org/">Node.js</a> 12 or later</p></li>
|
|
237
|
+
</ul>
|
|
238
|
+
<p>Once this is done, run this command <em>from the test or the benchmark directory</em> (depending on what you want to build):</p>
|
|
239
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> koffi/test <span class="c1"># or cd koffi/benchmark</span>
|
|
240
|
+
node ../../cnoke/cnoke.js
|
|
241
|
+
</pre></div>
|
|
242
|
+
</div>
|
|
243
|
+
</section>
|
|
244
|
+
</section>
|
|
245
|
+
<section id="running-tests">
|
|
246
|
+
<h2>Running tests<a class="headerlink" href="#running-tests" title="Permalink to this heading">#</a></h2>
|
|
247
|
+
<p>Koffi is tested on multiple architectures using emulated (accelerated when possible) QEMU machines. First, you need to install qemu packages, such as <code class="docutils literal notranslate"><span class="pre">qemu-system</span></code> (or even <code class="docutils literal notranslate"><span class="pre">qemu-system-gui</span></code>) on Ubuntu.</p>
|
|
248
|
+
<p>These machines are not included directly in this repository (for license and size reasons), but they are available here: <a class="reference external" href="https://koromix.dev/files/machines/">https://koromix.dev/files/machines/</a></p>
|
|
249
|
+
<p>For example, if you want to run the tests on Debian ARM64, run the following commands:</p>
|
|
250
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> luigi/koffi/qemu/
|
|
251
|
+
wget -q -O- https://koromix.dev/files/machines/qemu_debian_arm64.tar.zst <span class="p">|</span> zstd -d <span class="p">|</span> tar xv
|
|
252
|
+
sha256sum -c --ignore-missing registry/sha256sum.txt
|
|
253
|
+
</pre></div>
|
|
254
|
+
</div>
|
|
255
|
+
<p>Note that the machine disk content may change each time the machine runs, so the checksum test will fail once a machine has been used at least once.</p>
|
|
256
|
+
<p>And now you can run the tests with:</p>
|
|
257
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>node qemu.js <span class="c1"># Several options are available, use --help</span>
|
|
258
|
+
</pre></div>
|
|
259
|
+
</div>
|
|
260
|
+
<p>And be patient, this can be pretty slow for emulated machines. The Linux machines have and use ccache to build Koffi, so subsequent build steps will get much more tolerable.</p>
|
|
261
|
+
<p>By default, machines are started and stopped for each test. But you can start the machines ahead of time and run the tests multiple times instead:</p>
|
|
262
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>node qemu.js start <span class="c1"># Start the machines</span>
|
|
263
|
+
node qemu.js <span class="c1"># Test (without shutting down)</span>
|
|
264
|
+
node qemu.js <span class="c1"># Test again</span>
|
|
265
|
+
node qemu.js stop <span class="c1"># Stop everything</span>
|
|
266
|
+
</pre></div>
|
|
267
|
+
</div>
|
|
268
|
+
<p>You can also restrict the test to a subset of machines:</p>
|
|
269
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Full test cycle</span>
|
|
270
|
+
node qemu.js <span class="nb">test</span> debian_x64 debian_i386
|
|
271
|
+
|
|
272
|
+
<span class="c1"># Separate start, test, shutdown</span>
|
|
273
|
+
node qemu.js start debian_x64 debian_i386
|
|
274
|
+
node qemu.js <span class="nb">test</span> debian_x64 debian_i386
|
|
275
|
+
node qemu.js stop
|
|
276
|
+
</pre></div>
|
|
277
|
+
</div>
|
|
278
|
+
<p>Finally, you can join a running machine with SSH with the following shortcut, if you need to do some debugging or any other manual procedure:</p>
|
|
279
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>node qemu.js ssh debian_i386
|
|
280
|
+
</pre></div>
|
|
281
|
+
</div>
|
|
282
|
+
<p>Each machine is configured to run a VNC server available locally, which you can use to access the display, using KRDC or any other compatible viewer. Use the <code class="docutils literal notranslate"><span class="pre">info</span></code> command to get the VNC port.</p>
|
|
283
|
+
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>node qemu.js info debian_x64
|
|
284
|
+
</pre></div>
|
|
285
|
+
</div>
|
|
286
|
+
</section>
|
|
287
|
+
<section id="todo-list">
|
|
288
|
+
<h2>Todo list<a class="headerlink" href="#todo-list" title="Permalink to this heading">#</a></h2>
|
|
289
|
+
<p>After the release of version 1.3.0, the current priorities for the next major release are:</p>
|
|
290
|
+
<ul class="simple">
|
|
291
|
+
<li><p>Automate Windows/AArch64 (qemu) and macOS/AArch64 (how?) tests and builds</p></li>
|
|
292
|
+
<li><p>Create a real-world example, using several libraries (Raylib, SQLite, libsodium) to illustrate how to work with various C API styles</p></li>
|
|
293
|
+
</ul>
|
|
294
|
+
<p>The following features are also planned eventually, not necessarily in that order:</p>
|
|
295
|
+
<ul class="simple">
|
|
296
|
+
<li><p>Optimize passing of structs and arrays, with separate HFA-specific helper functions</p></li>
|
|
297
|
+
<li><p>Add simple struct type parser</p></li>
|
|
298
|
+
<li><p>Add more ways to manually encode and decode various types to and from byte arrays</p></li>
|
|
299
|
+
<li><p>Add support for unions</p></li>
|
|
300
|
+
<li><p>Provide better ways to automatically deal with caller/heap-allocated memory (strings, etc.)</p></li>
|
|
301
|
+
<li><p>Port Koffi to PowerPC (POWER9+) ABI</p></li>
|
|
302
|
+
</ul>
|
|
303
|
+
</section>
|
|
304
|
+
</section>
|
|
305
|
+
|
|
306
|
+
</article>
|
|
307
|
+
</div>
|
|
308
|
+
<footer>
|
|
309
|
+
|
|
310
|
+
<div class="related-pages">
|
|
311
|
+
|
|
312
|
+
<a class="prev-page" href="benchmarks">
|
|
313
|
+
<svg><use href="#svg-arrow-right"></use></svg>
|
|
314
|
+
<div class="page-info">
|
|
315
|
+
<div class="context">
|
|
316
|
+
<span>Previous</span>
|
|
317
|
+
</div>
|
|
318
|
+
|
|
319
|
+
<div class="title">Benchmarks</div>
|
|
320
|
+
|
|
321
|
+
</div>
|
|
322
|
+
</a>
|
|
323
|
+
</div>
|
|
324
|
+
<div class="bottom-of-page">
|
|
325
|
+
<div class="left-details">
|
|
326
|
+
<div class="copyright">
|
|
327
|
+
Copyright © 2022, Niels Martignène
|
|
328
|
+
</div>
|
|
329
|
+
Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
|
|
330
|
+
|
|
331
|
+
<a href="https://github.com/pradyunsg/furo">Furo</a>
|
|
332
|
+
|
|
333
|
+
</div>
|
|
334
|
+
<div class="right-details">
|
|
335
|
+
<div class="icons">
|
|
336
|
+
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
</footer>
|
|
342
|
+
</div>
|
|
343
|
+
<aside class="toc-drawer">
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<div class="toc-sticky toc-scroll">
|
|
347
|
+
<div class="toc-title-container">
|
|
348
|
+
<span class="toc-title">
|
|
349
|
+
Contents
|
|
350
|
+
</span>
|
|
351
|
+
</div>
|
|
352
|
+
<div class="toc-tree-container">
|
|
353
|
+
<div class="toc-tree">
|
|
354
|
+
<ul>
|
|
355
|
+
<li><a class="reference internal" href="#">Contributing</a><ul>
|
|
356
|
+
<li><a class="reference internal" href="#bugs-and-feature-requests">Bugs and feature requests</a></li>
|
|
357
|
+
<li><a class="reference internal" href="#build-from-source">Build from source</a><ul>
|
|
358
|
+
<li><a class="reference internal" href="#windows">Windows</a></li>
|
|
359
|
+
<li><a class="reference internal" href="#other-platforms">Other platforms</a></li>
|
|
360
|
+
</ul>
|
|
361
|
+
</li>
|
|
362
|
+
<li><a class="reference internal" href="#running-tests">Running tests</a></li>
|
|
363
|
+
<li><a class="reference internal" href="#todo-list">Todo list</a></li>
|
|
364
|
+
</ul>
|
|
365
|
+
</li>
|
|
366
|
+
</ul>
|
|
367
|
+
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
</aside>
|
|
374
|
+
</div>
|
|
375
|
+
</div><script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
|
|
376
|
+
<script src="_static/jquery.js"></script>
|
|
377
|
+
<script src="_static/underscore.js"></script>
|
|
378
|
+
<script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
|
|
379
|
+
<script src="_static/doctools.js"></script>
|
|
380
|
+
<script src="_static/scripts/furo.js"></script>
|
|
381
|
+
</body>
|
|
382
|
+
</html>
|