Jump to content

how to create such a plugin


photo

Recommended Posts

Currently, we need database support in our project, the easiest way to create a database support is to use sqlite and a plugin.

 

but sqlite use some structure as it's function argument:

in almost every function like

int sqlite3_prepare(
 sqlite3 *db,        	/* Database handle */
 const char *zSql,   	/* SQL statement, UTF-8 encoded */
 int nByte,              /* Maximum length of zSql in bytes. */
 sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
 const char **pzTail 	/* OUT: Pointer to unused portion of zSql */
);

but in fact the sqlite3 and sqlite3_stmt is just a empty structure

typedef struct sqlite3_stmt sqlite3_stmt;
typedef struct sqlite3 sqlite3;

 

these empty structure only used as pointer, how to declare these function and these structure as pointer usage only?I tried with these:

ExternClass<sqlite3> *pSqlite3 = MakeExternClass<sqlite3>();
   Interpreter::addExternClass("sqlite3", pSqlite3);
   Interpreter::addExternLibrary("sqlite");
   Interpreter::addExternFunction("sqlite.open", MakeExternFunction(&sqlite3_open));

 

but it can't work, compile give me this errors

include\unigineinterpreter.h(3403): warning C4150: deletion of pointer to incomplete type 'sqlite3'; no destructor called

Link to comment
×
×
  • Create New...