How to create an SQL Function in QSqlDatabase?
How to create an SQL Function in QSqlDatabase? The method, described in Adding a custom sqlite function to a Qt application it doesn't work. When sqlite3_create_function is called, the program crashes, although there is a call to sqlite3_initialize. QSqlDatabase uses C:/Qt/5.15.0/msvc2019_64/plugins/sqldrivers/qsqlite.dll, and sqlite3_create_function is called from sqlite3.c, added to the project. I added sqlite3.c because the linker does not find sqlite3_create_function
Re: How to create an SQL Function in QSqlDatabase?
I can't help with the specific sqlite3_create_function but the overall description of your problem would match with a version conflict between the header you use during compile and the library you use at runtime. That you have to add sqlite3.c to your project in order for the linker to find the symbol may indicate that you mix different calling conventions - the linker looks for a symbol with different marshaling. Depending on call parameters and other activities on the stack an application may survive the function entry but die with obscure symptoms later on.
So, double check if the sqlite header and implementation belong together.