a little more details on how I use the extension with sqlite3: In my shell script, I am running sqlite3 on all files of a folder:
find "./scripts" -iname "*.sql" | while read sqlfile do echo " -- ${sqlfile}" /usr/local/bin/sqlite3 mydb.db3 < $sqlfile; done and in my sql script, I am loading the dll extension made with Qt: .load ../../libsqliteextensions.dylib The compilation of the dll goes like: g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W -fPIC -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.7.0/mkspecs/macx-g++ -I. -I/usr/local/Trolltech/Qt-4.7.0/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Trolltech/Qt-4.7.0/include/QtCore -I/usr/local/Trolltech/Qt-4.7.0/include -Icompil/moc -F/usr/local/Trolltech/Qt-4.7.0/lib -o compil/obj/sqliteextensions.o src/sqliteextensions.cpp g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -single_module -dynamiclib -compatibility_version 1.0 -current_version 1.0.0 -install_name libsqliteextensions.1.dylib -o libsqliteextensions.1.0.0.dylib compil/obj/sqliteextensions.o -F/usr/local/Trolltech/Qt-4.7.0/lib -L/usr/local/Trolltech/Qt-4.7.0/lib -L/usr/local/lib/ -framework QtCore -L/usr/local/Trolltech/Qt-4.7.0/lib I hope that it makes thing clearer. Best regards, Sylvain On Tue, May 18, 2010 at 7:40 PM, Sylvain Pointeau < sylvain.point...@gmail.com> wrote: > hello, > > I am facing a very bizarre issue. > I am on mac os x 64 bits. > > I needed a uuid() function that generates GUID. > I created then a dll with Qt like: > > #include "/usr/local/include/sqlite3ext.h" > SQLITE_EXTENSION_INIT1 > > #include <QtCore/QUuid> > #include <string.h> > > extern "C" void sqlite3_uuid(sqlite3_context *context, int argc, > sqlite3_value **argv){ > QUuid uuid = QUuid::createUuid(); > QString s = uuid; > s.remove(0,1); > s.remove(s.size()-1,1); > QByteArray to_utf8 = s.toAscii(); > sqlite3_result_text( context, to_utf8.constData(), -1, SQLITE_TRANSIENT > ); > } > > extern "C" int sqlite3_extension_init( > sqlite3 *db, > char **pzErrMsg, > const sqlite3_api_routines *pApi > ){ > SQLITE_EXTENSION_INIT2(pApi) > sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8, 0, sqlite3_uuid, 0, > 0); > return 0; > } > > I compiled Qt with cocoa > > then after when I run a script, only in a shell, when I first try to insert > a GUID, it says that the primary key already exists, which is obviously > wrong. > However, this error occurs only in a shell script, not in the command line > (unbelievable!). > > I could only fallback to use uuid from boost and it works perfectly. > > Is it safe to use Qt to implement a dll for creating user functions? > Do you have any idea on what happens here? (any hints?) > > I have no idea how to narrow down the problem, > is someone interested to investigate? if yes I can build a minimal project > (and try to reproduce the same issue) > > Any hints are warmly welcome. > > Best regards, > Sylvain > > > > > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users