@@ -74,6 +74,20 @@ void _sqlite3_result_blob(sqlite3_context* ctx, const void* b, int l) {
74
74
sqlite3_result_blob(ctx, b, l, SQLITE_TRANSIENT);
75
75
}
76
76
77
+
78
+ int _sqlite3_create_function(
79
+ sqlite3 *db,
80
+ const char *zFunctionName,
81
+ int nArg,
82
+ int eTextRep,
83
+ uintptr_t pApp,
84
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
85
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
86
+ void (*xFinal)(sqlite3_context*)
87
+ ) {
88
+ return sqlite3_create_function(db, zFunctionName, nArg, eTextRep, (void*) pApp, xFunc, xStep, xFinal);
89
+ }
90
+
77
91
void callbackTrampoline(sqlite3_context*, int, sqlite3_value**);
78
92
void stepTrampoline(sqlite3_context*, int, sqlite3_value**);
79
93
void doneTrampoline(sqlite3_context*);
@@ -353,7 +367,7 @@ func (c *SQLiteConn) RegisterFunc(name string, impl interface{}, pure bool) erro
353
367
if pure {
354
368
opts |= C .SQLITE_DETERMINISTIC
355
369
}
356
- rv := C .sqlite3_create_function (c .db , cname , C .int (numArgs ), C .int (opts ), unsafe .Pointer (& fi ), (* [0 ]byte )(unsafe .Pointer (C .callbackTrampoline )), nil , nil )
370
+ rv := C ._sqlite3_create_function (c .db , cname , C .int (numArgs ), C .int (opts ), C . uintptr_t ( uintptr ( unsafe .Pointer (& fi )) ), (* [0 ]byte )(unsafe .Pointer (C .callbackTrampoline )), nil , nil )
357
371
if rv != C .SQLITE_OK {
358
372
return c .lastError ()
359
373
}
@@ -478,7 +492,7 @@ func (c *SQLiteConn) RegisterAggregator(name string, impl interface{}, pure bool
478
492
if pure {
479
493
opts |= C .SQLITE_DETERMINISTIC
480
494
}
481
- rv := C .sqlite3_create_function (c .db , cname , C .int (stepNArgs ), C .int (opts ), unsafe .Pointer (& ai ), nil , (* [0 ]byte )(unsafe .Pointer (C .stepTrampoline )), (* [0 ]byte )(unsafe .Pointer (C .doneTrampoline )))
495
+ rv := C ._sqlite3_create_function (c .db , cname , C .int (stepNArgs ), C .int (opts ), C . uintptr_t ( uintptr ( unsafe .Pointer (& ai )) ), nil , (* [0 ]byte )(unsafe .Pointer (C .stepTrampoline )), (* [0 ]byte )(unsafe .Pointer (C .doneTrampoline )))
482
496
if rv != C .SQLITE_OK {
483
497
return c .lastError ()
484
498
}
0 commit comments