On Fri, Feb 3, 2012 at 8:25 PM, Stephan Beal <sgb...@googlemail.com> wrote:

> i take that back - if that were the case then the crash would almost
> certainly happen later on (after your init routine returns). But it still
> can't hurt to try.
>

But please try this:

nr = (NiuRouting*) sqlite3_malloc(sizeof (NiuRouting));
...
*ppVTab = (sqlite3_vtab*) nr;

i'm not sure (i don't remember) if such a cast to the first type in a
struct is legal in C++ (it is in C). Try changing the 2nd line to:

*ppVTab = &nr->vtab;

And change:
((sqlite3_vtab*) nr)->zErrMsg = NULL;

to:
nr->vtab.zErrMsg = NULL;

The casts aren't necessary (this is C++!) and hurt the readability.

Note that nr is NOT initialized in your code (it is allocated, but not set
up). Does it need to be? (i'm not familiar with the vtable's requirements -
maybe it only needs to be allocated.)

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to