forked from sqlite/sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite_darwin_arm64.go
More file actions
181 lines (140 loc) · 7.46 KB
/
Copy pathsqlite_darwin_arm64.go
File metadata and controls
181 lines (140 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//go:build darwin && arm64 && go1.25
// Code generated by c2go-bind. DO NOT EDIT.
// Input-derived material retains the input's copyright and license. This file
// also contains original C2Go runtime-support code copied from c2go-bind,
// available under AGPL-3.0-only or a separate commercial agreement.
// See https://github.com/c2gohq/c2go_bind/blob/main/LICENSING.md.
package sqlite
import (
_ "github.com/c2gohq/c2go_libc"
"unsafe"
)
// ─── Types ──────────────────────────────────────────────────
// ─── Function declarations ──────────────────────────────────
// Bodies provided by clang-emitted Plan 9 .s with TEXT ·<name>(SB)
// at ABI0. Go compiler auto-generates the ABIInternal wrapper.
//go:linkname Sqlite3BindDouble github.com/c2gohq/sqlite.sqlite3_bind_double
func Sqlite3BindDouble(stmt unsafe.Pointer, index int32, value float64) int32
//go:linkname Sqlite3BindInt github.com/c2gohq/sqlite.sqlite3_bind_int
func Sqlite3BindInt(stmt unsafe.Pointer, index int32, value int32) int32
//go:linkname Sqlite3BindInt64 github.com/c2gohq/sqlite.sqlite3_bind_int64
func Sqlite3BindInt64(stmt unsafe.Pointer, index int32, value int64) int32
//go:linkname Sqlite3BindNull github.com/c2gohq/sqlite.sqlite3_bind_null
func Sqlite3BindNull(stmt unsafe.Pointer, index int32) int32
//go:linkname Sqlite3BindText github.com/c2gohq/sqlite.sqlite3_bind_text
func Sqlite3BindText(stmt unsafe.Pointer, index int32, value unsafe.Pointer, length int32, destructor uintptr) int32
//go:linkname Sqlite3Close github.com/c2gohq/sqlite.sqlite3_close
func Sqlite3Close(db unsafe.Pointer) int32
//go:linkname Sqlite3CloseV2 github.com/c2gohq/sqlite.sqlite3_close_v2
func Sqlite3CloseV2(db unsafe.Pointer) int32
//go:linkname Sqlite3ColumnCount github.com/c2gohq/sqlite.sqlite3_column_count
func Sqlite3ColumnCount(stmt unsafe.Pointer) int32
//go:linkname Sqlite3ColumnDouble github.com/c2gohq/sqlite.sqlite3_column_double
func Sqlite3ColumnDouble(stmt unsafe.Pointer, column int32) float64
//go:linkname Sqlite3ColumnInt github.com/c2gohq/sqlite.sqlite3_column_int
func Sqlite3ColumnInt(stmt unsafe.Pointer, column int32) int32
//go:linkname Sqlite3ColumnInt64 github.com/c2gohq/sqlite.sqlite3_column_int64
func Sqlite3ColumnInt64(stmt unsafe.Pointer, column int32) int64
//go:linkname Sqlite3ColumnText github.com/c2gohq/sqlite.sqlite3_column_text
func Sqlite3ColumnText(stmt unsafe.Pointer, column int32) *byte
//go:linkname Sqlite3Errmsg github.com/c2gohq/sqlite.sqlite3_errmsg
func Sqlite3Errmsg(db unsafe.Pointer) *byte
//go:linkname Sqlite3Exec github.com/c2gohq/sqlite.sqlite3_exec
func Sqlite3Exec(db unsafe.Pointer, sql unsafe.Pointer, callback uintptr, arg unsafe.Pointer, errmsg unsafe.Pointer) int32
//go:linkname Sqlite3ExtendedErrcode github.com/c2gohq/sqlite.sqlite3_extended_errcode
func Sqlite3ExtendedErrcode(db unsafe.Pointer) int32
//go:linkname Sqlite3Finalize github.com/c2gohq/sqlite.sqlite3_finalize
func Sqlite3Finalize(stmt unsafe.Pointer) int32
//go:linkname Sqlite3Initialize github.com/c2gohq/sqlite.sqlite3_initialize
func Sqlite3Initialize() int32
//go:linkname Sqlite3Libversion github.com/c2gohq/sqlite.sqlite3_libversion
func Sqlite3Libversion() *byte
//go:linkname Sqlite3LibversionNumber github.com/c2gohq/sqlite.sqlite3_libversion_number
func Sqlite3LibversionNumber() int32
//go:linkname Sqlite3Open github.com/c2gohq/sqlite.sqlite3_open
func Sqlite3Open(filename unsafe.Pointer, ppDb unsafe.Pointer) int32
//go:linkname Sqlite3PrepareV2 github.com/c2gohq/sqlite.sqlite3_prepare_v2
func Sqlite3PrepareV2(db unsafe.Pointer, sql unsafe.Pointer, nByte int32, ppStmt unsafe.Pointer, pzTail unsafe.Pointer) int32
//go:linkname Sqlite3Reset github.com/c2gohq/sqlite.sqlite3_reset
func Sqlite3Reset(stmt unsafe.Pointer) int32
//go:linkname Sqlite3Shutdown github.com/c2gohq/sqlite.sqlite3_shutdown
func Sqlite3Shutdown() int32
//go:linkname Sqlite3Sourceid github.com/c2gohq/sqlite.sqlite3_sourceid
func Sqlite3Sourceid() *byte
//go:linkname Sqlite3Step github.com/c2gohq/sqlite.sqlite3_step
func Sqlite3Step(stmt unsafe.Pointer) int32
// ─── Linkname bridges (path-b) ───────────────────────────────
// Clang emitted these symbols under sanitised local names
// because their raw Go import paths contain characters Plan 9
// assembler can't represent (`-`). The directives below let
// the Go linker resolve those locals to the real packages.
//go:linkname _c2go_imp_github_com_c2gohq_c2go_libc_Bzero github.com/c2gohq/c2go_libc.Bzero
func _c2go_imp_github_com_c2gohq_c2go_libc_Bzero(memory unsafe.Pointer, length uint64)
//go:nosplit
func github_com_c2gohq_c2go_libc_Bzero(memory unsafe.Pointer, length uint64) {
_c2go_imp_github_com_c2gohq_c2go_libc_Bzero(memory, length)
}
// ─── Embedded runtime-support helpers ───────────────────────
// _c2go_cgocall is a thin shim around runtime.cgocall, used by the
// cross-world bridge for unmanaged function calls. Only emitted when
// the sidecar declares unmanaged extern functions; v0 always emits
// for simplicity.
//
// #218 fix: Go 1.25 stopped honouring the bodyless-decl form of
// //go:linkname (the symbol named on the local side was no longer
// rewritten to the runtime target — the .s reference would resolve
// to sqlitepkg._c2go_cgocall which the runtime never provided).
// Use the alias-then-wrap pattern: pull runtime.cgocall into a
// private local name via linkname, then expose the public name as
// a thin wrapper.
//
//go:linkname _runtime_cgocall runtime.cgocall
//go:noescape
func _runtime_cgocall(fn unsafe.Pointer, frame unsafe.Pointer) int32
//go:nosplit
func _c2go_cgocall(fn unsafe.Pointer, frame unsafe.Pointer) int32 {
return _runtime_cgocall(fn, frame)
}
// _c2go_typedmemmove copies a typed value, invoking the bulk write
// barrier when the type has pointers. Used by realloc lowering and
// the c2go-memcpy-typing pass.
//
//go:linkname _runtime_typedmemmove runtime.typedmemmove
//go:noescape
func _runtime_typedmemmove(typ unsafe.Pointer, dst, src unsafe.Pointer)
//go:nosplit
func _c2go_typedmemmove(typ unsafe.Pointer, dst, src unsafe.Pointer) {
_runtime_typedmemmove(typ, dst, src)
}
// _c2go_typedMemmoveArray is the per-element loop used by the
// c2go-memcpy-typing pass when copying arrays of pointerful elements.
//
//go:nosplit
func _c2go_typedMemmoveArray(typ unsafe.Pointer, dst, src unsafe.Pointer, n uintptr) {
sz := *(*uintptr)(typ) // _type.Size_ at offset 0 (pinned Go 1.22+)
for i := uintptr(0); i < n; i++ {
_c2go_typedmemmove(typ,
unsafe.Pointer(uintptr(dst)+i*sz),
unsafe.Pointer(uintptr(src)+i*sz))
}
}
// _c2go_writePtr is the slow-path of the inline write barrier.
// The LLVM c2go-write-barriers pass emits an inline check of
// runtime.writeBarrier.enabled; on the slow path it calls this
// helper. The Go compiler, seeing the *slot = val store in this
// body, emits the real inline barrier sequence (gcWriteBarrier2
// reservation + push). We never touch the special-ABI helper directly.
//
//go:nosplit
func _c2go_writePtr(slot *unsafe.Pointer, val unsafe.Pointer) {
*slot = val
}
// errString is used by the §E2 unmanaged-extern wrappers' dlsym-
// failure panic path. Kept zero-import (no fmt) so the wrappers
// don't drag in extra runtime cost.
func errString(err error) string {
if err == nil {
return "<nil>"
}
return err.Error()
}