Page 1 of 1

wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Tue Jul 12, 2016 9:23 pm
by catalin
Hello,

I've downloaded master code from github and built debug win32 with VC12 and wxW3.1 (I've modified the project file to link against the correct libs).
When running minimald.exe I get the following message and the app exits:
The procedure entry point sqlite3_compileoption_used could not be located in the dynamic link library sqlite3.dll.
Does anybody have any idea what might go wrong?

Re: wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Wed Jul 13, 2016 7:21 am
by utelle
catalin wrote:I've downloaded master code from github and built debug win32 with VC12 and wxW3.1 (I've modified the project file to link against the correct libs).
I will try to add direct support for wxWidgets 3.1 in the future.
catalin wrote:When running minimald.exe I get the following message and the app exits:
The procedure entry point sqlite3_compileoption_used could not be located in the dynamic link library sqlite3.dll.
Does anybody have any idea what might go wrong?
I suspect that an outdated SQLite DLL was found on the search path first.

The function sqlite3_compileoption_used was introduced in SQLite3 Version 3.6.23. That is, if the entry point is missing the found DLL represents an older version of SQLite.

It is important to compile wxSQLite3 using the header file and the link library of the SQLite3 version that will be used with the application. In case of dynamically loading the SQLite DLL, wxSQLite3 could be enhanced to check the SQLite version at runtime. However, if a link library was used, this is not possible, because the operating system loads the DLL (and emits an error message in case of problems), before wxSQLite3 gets a chance to check the SQLite version number.

Although wxSQLite3 supports the use of SQLite3 DLLs, I would strongly recommend to bundle SQLite statically compiled with your application. That way your application would always use the expected version of SQLite.

Regards,

Ulrich

Re: wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Wed Jul 13, 2016 9:37 am
by catalin
Thanks for the answer!
Indeed, copying one of the sqlite3\secure\aesXXX\dll\release\sqlite3.dll into samples\ did start minimald.exe (using sqlite3\lib\sqlite3.dll still failed, but with a different error).

I have nothing against statically compiled SQLite, but this is the sample that comes with wxSQLite3. Maybe the sample should also use statically compiled SQLite? Or somehow (a post-build step would create a hard link to the correct dll inside samples\) make sure the right dll is used when attempting to run it?

In case it helps, wxW has wxShortVersionString symbol defined in build\msw\wx_setup.props. Maybe that can be used for wxW library names, i.e. wxbase$(wxShortVersionString)ud.lib ? or even better, wxbase$(wxShortVersionString)$(wxSuffix).lib
I didn't try it myself though...

Regards,
C

Re: wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Thu Jul 14, 2016 8:33 am
by utelle
catalin wrote:Indeed, copying one of the sqlite3\secure\aesXXX\dll\release\sqlite3.dll into samples\ did start minimald.exe (using sqlite3\lib\sqlite3.dll still failed, but with a different error).
What error did you get? If it is a bug in wxSQLite3 or the sample application, it should certainly be fixed.
catalin wrote:I have nothing against statically compiled SQLite, but this is the sample that comes with wxSQLite3. Maybe the sample should also use statically compiled SQLite? Or somehow (a post-build step would create a hard link to the correct dll inside samples\) make sure the right dll is used when attempting to run it?
Maybe it would be indeed the best to use a statically compiled SQLite library as the default for building wxSQLite3.
catalin wrote:In case it helps, wxW has wxShortVersionString symbol defined in build\msw\wx_setup.props. Maybe that can be used for wxW library names, i.e. wxbase$(wxShortVersionString)ud.lib ? or even better, wxbase$(wxShortVersionString)$(wxSuffix).lib
I didn't try it myself though...
I'll have to check how this is solved in wxWidgets and how I can adopt this mechansim.

Regards,

Ulrich

Re: wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Thu Jul 14, 2016 8:55 am
by catalin
utelle wrote:What error did you get?
With sqlite3\lib\sqlite3.dll I got
The procedure entry point sqlite3_key could not be located in the dynamic link library sqlite3.dll.

Re: wxSQLite3 - minimald.exe - Entry Point Not Found

Posted: Thu Jul 14, 2016 10:01 am
by utelle
catalin wrote:With sqlite3\lib\sqlite3.dll I got
The procedure entry point sqlite3_key could not be located in the dynamic link library sqlite3.dll.
The folder sqlite3\lib contains the SQLite DLL originally distributed with SQLite, that is, it does not support encryption. If you compiled wxSQLite3 with enryption support enabled - as you obviously did -, you have to use the pre-compiled SQLite DLL with encryption support, either sqlite3\secure\aes128\dll\release or sqlite3\secure\aes256\dll\release depending on whether you want to use AES 128 bit or 256 bit encryption.

As you said in a previous post, it would be probably best to compile wxSQLite3 with a statically linked SQLite library to avoid such confusion.

Regards,

Ulrich