I've been testing this with a similar setup to yours, but maybe we have
different options for the SQLite library we're testing against. The default
SQLite install on my Mac didn't have loadable extension support compiled in, so
I tested with a separate SQLite amalgamation. Its the same version
Line 55 is the call to register the function with SQLite. Off the top of my
head, I'm not sure what would be crashing there. There is no check about
whether the PSqlite3 object is valid. That is supplied by SQLite, but I suppose
we should be checking its validity.
Independent of this, I did
Nim Compiler Version 0.19.4 [MacOSX: amd64]
SQLite version 3.27.2 2019-02-25 16:06:06
sqlite> .load libhelloworld
Traceback (most recent call last)
helloworld.nim(55) sqlite3_helloworld_init
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
I was playing around with making a SQLite extension in Nim the other day.
Here's a simple example of how to do this. This example defines a _hello_
function in SQL that takes one parameter and returns "Hello ". With a
bit more effort you can do things like create virtual tables, etc.