I'd suggest having your own sqlite3.dll in your own application's working 
folder, rather than relying on an existing version somewhere on the PC already 
which could be any version!

If you created your own DLL, why would you then want to statically link to it 
(defeating a lot of the point of a *dynamic* load library)?  That doesn't 
provide you with any back/forwards compatibility.  Why not dynamically load the 
sqlite3.dll and the required functions at runtime instead?  If the functions 
can't be found on the load, you would then be able to handle it gracefully and 
inform the user, rather than having the prompt of a procedure entry point 
error, which means nothing to non-programmer users.

>From a C program, this is the kind of thing I'd do (example just loads the 
>function sqlite3_libversion_number from sqlite3.dll - note that I've 
>hand-coded this so it hasn't been checked for typos!):

//...
// include necessary windows headers for LoadLibrary() API etc.
#include <sqlite3.h>            // for sqlite-specific typedefs/structures/etc
//...

typedef int (SQLITE_API * MYPROC)(void);        // a typedef'd version of the 
function definition of sqlite3_libversion_number() prototype from sqlite3.h

static HANDLE HLib = NULL;                      // handle to sqlite3 library, 
once opened
static MYPROC MySqlite3LibVersion = NULL;// will contain a pointer to our 
imported sqlite3_libversion_number() function

BOOL LoadSqliteLibrary()
{
        BOOL Ret = TRUE;

        if (HLib != NULL)
        {
                // dynamically load sqlite3.dll
                HLib = LoadLibrary( "sqlite3.dll" );

                // if library loaded okay, get the required procedures' address 
pointers out
                if (HLib != NULL)
                {
                        // get pointer to sqlite3_libversion_number from the 
dll for our own use
                        MySqlite3LibVersion = GetProcAddress( HLib, 
"sqlite3_libversion_number" );

                        // if we couldn't find the required procedure's entry 
point...
                        If (MySqlite3Exec == NULL)
                        {
                                // procedure entry point may not exist in 
loaded library!
                                Ret = FALSE;
                                // free library on procedure load error, as not 
much use any more
                                FreeLibrary( HLib );
                                HLib = NULL;
                                // ... possibly inform user of the error at 
this point?
                        }
                }
                else
                {
                        // library failed to load - sqlite3.dll file may not 
exist
                        Ret = FALSE;
                        // ... possibly inform user of the error at this point?
                }
        }
        // else library is already loaded

        return (Ret);
}

//...
// As long as LoadSqliteLibrary() returns TRUE, you can now use 
MySqlite3LibVersion() to return the library version number.
//...

Thanks,
Nick.

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Teg
Sent: 24 December 2009 00:57
To: General Discussion of SQLite Database
Subject: Re: [sqlite] sqlite3_prepare_v2


I statically link for exactly this reason. If I WAS going to dynamic
link though, I'd make my own DLL from the sources, give it a unique
name, link against it's import lib and keep it in the same folder as
my EXE.

C


Wednesday, December 23, 2009, 4:50:08 PM, you wrote:

DRH> On Dec 23, 2009, at 4:12 PM, Dr. Robert N. Cleaves wrote:

>> Dear Sir:
>>
>> On startup, I get a message that the procedure entry point  
>> sqlite3_prepare_v2 is missing from the dynamic link library  
>> SQLite3.dll. How can I download the missing item?
>>
>> Thank youÂ…

DRH> I'm guessing you are running windows.  Probably you have two or more  
DRH> applications installed that use SQLite.  (Candidates applications  
DRH> include Skype, Google Gears, Firefox, McAfee Antivirus, Adobe  
DRH> Acroread, Adobe Photoshop, iTunes, DropBox, and many others.)   
DRH> Probably when one of these applications was installing itself, it  
DRH> overwrote the system SQLite3.dll with an older version that does not  
DRH> support the sqlite3_prepare_v2() interface.  Then when one of the  
DRH> other applications that needs the new interface tries to run, it gets
DRH> the older DLL that lacks the necessary entry point.

DRH> I beg and plead with application vendors to statically link against  
DRH> SQLite to avoid this kind of problem, but nobody listens to me about  
DRH> that....

DRH> I don't use windows myself and so I won't be much help in  
DRH> troubleshooting this.  But I have forwarded this reply to the SQLite  
DRH> mailing list where there are lots of windows users.  Perhaps someone  
DRH> there can explain what needs to be done....


>>
>> Dr. Robert N. Cleaves
>> President
>> Wilderness Conservancy
>> and Project CARE
>> www.wildcon.org
>> b...@wildcon.org
>> (310) 472-2593
>>
>> I am using the Free version of SPAMfighter.
>> We are a community of 6 million users fighting spam.
>> SPAMfighter has removed 37 of my spam emails to date.
>> The Professional version does not have this message.

DRH> D. Richard Hipp
DRH> d...@hwaci.com



DRH> _______________________________________________
DRH> sqlite-users mailing list
DRH> sqlite-users@sqlite.org
DRH> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



-- 
Best regards,
 Teg                            mailto:t...@djii.com

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to