Re: [sqlite] sqlite3_create_function callback problem

2008-12-19 Thread Guillaume Schub
Ok, I figured it out !!! This was actually a calling convention problem. Our software is built using __fastcall as default convention, and the function in sqlite3.h is declared as: int __cdecl sqlite3_create_function( sqlite3 *, const char *zFunctionName, int nArg, int eTextRep, void*,

Re: [sqlite] sqlite3_create_function callback problem

2008-12-19 Thread Guillaume Schub
Sorry I forgot to mention: I already tried single C function. I even tried with extern "C" just in case but got exactly the same result. I also tried __stdcall and __cdecl but looks like SQLite is wayting for __fastcall function pointer On Wed, Dec 17, 2008 at 5:37 PM, Martin Engelschalk

Re: [sqlite] sqlite3_create_function callback problem

2008-12-19 Thread Guillaume Schub
Hello, Looks like my last reply wasn't received So I tried with a static function out of a class without more success. Then I tried changing the calling convention to __stdcall and even __cdecl, but I got a compilation error asking for a __fastcall function, so no more success here (I'm

Re: [sqlite] sqlite3_create_function callback problem

2008-12-18 Thread Igor Tandetnik
Guillaume Schub wrote: > sqlite3_create_function(m_pDB, "ScorePosition", "ScorePosition", 8, > SQLITE_ANY, NULL, , NULL, NULL); > > class MyClass > { > ... > static void ScorePosition(sqlite3_context *pContext,int argc, > sqlite3_value** argv); > ... > }; > > No the problem

Re: [sqlite] sqlite3_create_function callback problem

2008-12-18 Thread Teg
Guillaume, This is my callback function. As Martin suggested, it's defined outside of any class. It looks to me like you're not passing the correct parameters tothe create function. static void sqlite3_regexp(sqlite3_context *pDB, int argc, sqlite3_value **argv) { CDBSqLite3* pThis =

Re: [sqlite] sqlite3_create_function callback problem

2008-12-17 Thread Martin Engelschalk
Hi, i suspect that you problem is the class MyClass. Try to define your function "ScorePosition" as a C-function outside of a class. Martin Guillaume Schub wrote: > Hi everyone, > > I have spent nearly one day on this already with no success. I am > currently trying to create some custom

[sqlite] sqlite3_create_function callback problem

2008-12-17 Thread Guillaume Schub
Hi everyone, I have spent nearly one day on this already with no success. I am currently trying to create some custom function on a SQLite3 database. What I did (just to test): sqlite3_create_function(m_pDB, "ScorePosition", "ScorePosition", 8, SQLITE_ANY, NULL, , NULL, NULL); class MyClass {