steve3d Posted August 24, 2011 Share Posted August 24, 2011 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
steve3d Posted August 24, 2011 Author Share Posted August 24, 2011 or, should I use another way to do this, wrap all these function in my own wrapper and the export to interpreter? Link to comment
steve3d Posted August 25, 2011 Author Share Posted August 25, 2011 ok, I've successfully created a tiny wrapper class for sqlite function. Link to comment
Recommended Posts