tags:

views:

105

answers:

1

sqlite3_auto_extension looks like a good way to register a statically linked extension. But I don't understand the callback declaration:


void (*xEntryPoint)(void);

Shouldn't the callback be like sqlite3_extension_init?


int sqlite3_extension_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
)

+4  A: 

I'm puzzled too why the callback is declared like that. sqllite calls it like:

xInit(db, &zErrmsg, &sqlite3Apis);

So you should have e.g.

int my_extension(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi)
{
  //register stuff
  return 0; //ok
}

...
sqlite3_auto_extension((void*)my_extension);
nos
Probably for ABI compatibility reasons.
Sean Bright