Passing a path to sqlite3.exe to load a dll

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Passing a path to sqlite3.exe to load a dll

Jose Isaias Cabrera-4

Greetings!

I am trying to load a DLL to the DOS tool, but it's failing.  I am trying,

sqlite> .load c:\PMOProjects\sqlite3libIN sqlite3_decimal_init
Error: The specified module could not be found.

Any help would be greatly appreciated.  Also, if I would like to use the call,

int sqlite3_load_extension(
  sqlite3 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
);

What would be the path to use in Windows?  Thanks so much.

josé

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Keith Medcalf

Escape the reverse solstice with a duplicate reverse solstice (\ -> \\) or replace them with normal solstice (\ -> /) since Windows recognizes either as the path separator.  The CLI, like most things, parses escape sequences on input.

Same applies to the C API function.  You specify the full path and name of the file.  Since the compiler probably also parses escape sequences in its input, you probably need to escape your reverse solstice there as well.

--
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.

>-----Original Message-----
>From: sqlite-users <[hidden email]> On
>Behalf Of Jose Isaias Cabrera
>Sent: Tuesday, 26 November, 2019 12:35
>To: [hidden email]
>Subject: [sqlite] Passing a path to sqlite3.exe to load a dll
>
>
>Greetings!
>
>I am trying to load a DLL to the DOS tool, but it's failing.  I am
>trying,
>
>sqlite> .load c:\PMOProjects\sqlite3libIN sqlite3_decimal_init
>Error: The specified module could not be found.
>
>Any help would be greatly appreciated.  Also, if I would like to use the
>call,
>
>int sqlite3_load_extension(
>  sqlite3 *db,          /* Load the extension into this database
>connection */
>  const char *zFile,    /* Name of the shared library containing
>extension */
>  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
>  char **pzErrMsg       /* Put error message here if not 0 */
>);
>
>What would be the path to use in Windows?  Thanks so much.
>
>josé
>
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Jose Isaias Cabrera-4

Keith Medcalf, on Tuesday, November 26, 2019 02:57 PM, wrote...
>
>
> Escape the reverse solstice with a duplicate reverse solstice (\ -> \\) or replace them
> with normal solstice (\ -> /) since Windows recognizes either as the path separator.
> The CLI, like most things, parses escape sequences on input.
>
> Same applies to the C API function.  You specify the full path and name of the file.
> Since the compiler probably also parses escape sequences in its input, you probably
> need to escape your reverse solstice there as well.

Thanks for the support, Keith.  And yes, that is why I wrote.  I tried all of those.  Here are some examples:

14:22:23.19>sqlite3
SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load
Usage: .load FILE ?ENTRYPOINT?
sqlite> .load c:/PMOProjects/libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load c:\PMOProjects\libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .help load
.load FILE ?ENTRY?       Load an extension library
sqlite> .load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load c:/PMOProjects/libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load c://PMOProjects//libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load /PMOProjects/libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load c:\/PMOProjects\/libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite>
sqlite> .cd c:\PMOProjects
Cannot change to directory "c:PMOProjects"
sqlite> .cd c:\\PMOProjects
sqlite> .load ./libsqlite3decimal sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .load ./libsqlite3decimal.dll sqlite3_decimal_init
Error: The specified module could not be found.

sqlite> .cd
Usage: .cd DIRECTORY
sqlite> .cd c:\\PMOProjects
sqlite> .cd c:\PMOProjects
Cannot change to directory "c:PMOProjects"
sqlite> .q


15:08:12.49>sqlite3 --cmd '.load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init'
Error: unrecognized token: "'.load"
Error: near "sqlite3_decimal_init": syntax error

15:09:37.68>sqlite3 --cmd ".load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init"
Error: The specified module could not be found.

SQLite version 3.30.0 2019-10-04 15:03:17
Enter ".help" for usage hints.
sqlite>



> >I am trying to load a DLL to the DOS tool, but it's failing.  I am
> >trying,
> >
> >sqlite> .load c:\PMOProjects\sqlite3libIN sqlite3_decimal_init
> >Error: The specified module could not be found.
> >
> >Any help would be greatly appreciated.  Also, if I would like to use the
> >call,
> >
> >int sqlite3_load_extension(
> >  sqlite3 *db,          /* Load the extension into this database
> >connection */
> >  const char *zFile,    /* Name of the shared library containing
> >extension */
> >  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
> >  char **pzErrMsg       /* Put error message here if not 0 */
> >);
> >
> >What would be the path to use in Windows?  Thanks so much.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Keith Medcalf

What is the canonical name of the file you are trying to load?

For example, if you are trying to load the file "jitterbug.dll" from the directory "c:\a\b\c" then the canonical filename is "c:\a\b\c\jitterbug.dll"

It seems that you are being told that "c:\PMOProjects\libsqlite3decimal.dll" does not exist.  

Are you sure that the file exists and that you have permission to read/execute it?

--
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.

>-----Original Message-----
>From: sqlite-users <[hidden email]> On
>Behalf Of Jose Isaias Cabrera
>Sent: Tuesday, 26 November, 2019 13:28
>To: SQLite mailing list <[hidden email]>
>Subject: Re: [sqlite] Passing a path to sqlite3.exe to load a dll
>
>
>Keith Medcalf, on Tuesday, November 26, 2019 02:57 PM, wrote...
>>
>>
>> Escape the reverse solstice with a duplicate reverse solstice (\ -> \\)
>or replace them
>> with normal solstice (\ -> /) since Windows recognizes either as the
>path separator.
>> The CLI, like most things, parses escape sequences on input.
>>
>> Same applies to the C API function.  You specify the full path and name
>of the file.
>> Since the compiler probably also parses escape sequences in its input,
>you probably
>> need to escape your reverse solstice there as well.
>
>Thanks for the support, Keith.  And yes, that is why I wrote.  I tried
>all of those.  Here are some examples:
>
>14:22:23.19>sqlite3
>SQLite version 3.30.0 2019-10-04 15:03:17
>Enter ".help" for usage hints.
>Connected to a transient in-memory database.
>Use ".open FILENAME" to reopen on a persistent database.
>sqlite> .load
>Usage: .load FILE ?ENTRYPOINT?
>sqlite> .load c:/PMOProjects/libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load c:\PMOProjects\libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .help load
>.load FILE ?ENTRY?       Load an extension library
>sqlite> .load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load c:/PMOProjects/libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load c://PMOProjects//libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load /PMOProjects/libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load c:\/PMOProjects\/libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load c:\\PMOProjects\\libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite>
>sqlite> .cd c:\PMOProjects
>Cannot change to directory "c:PMOProjects"
>sqlite> .cd c:\\PMOProjects
>sqlite> .load ./libsqlite3decimal sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .load ./libsqlite3decimal.dll sqlite3_decimal_init
>Error: The specified module could not be found.
>
>sqlite> .cd
>Usage: .cd DIRECTORY
>sqlite> .cd c:\\PMOProjects
>sqlite> .cd c:\PMOProjects
>Cannot change to directory "c:PMOProjects"
>sqlite> .q
>
>
>15:08:12.49>sqlite3 --cmd '.load c:\\PMOProjects\\libsqlite3decimal
>sqlite3_decimal_init'
>Error: unrecognized token: "'.load"
>Error: near "sqlite3_decimal_init": syntax error
>
>15:09:37.68>sqlite3 --cmd ".load c:\\PMOProjects\\libsqlite3decimal
>sqlite3_decimal_init"
>Error: The specified module could not be found.
>
>SQLite version 3.30.0 2019-10-04 15:03:17
>Enter ".help" for usage hints.
>sqlite>
>
>
>
>> >I am trying to load a DLL to the DOS tool, but it's failing.  I am
>> >trying,
>> >
>> >sqlite> .load c:\PMOProjects\sqlite3libIN sqlite3_decimal_init
>> >Error: The specified module could not be found.
>> >
>> >Any help would be greatly appreciated.  Also, if I would like to use
>the
>> >call,
>> >
>> >int sqlite3_load_extension(
>> >  sqlite3 *db,          /* Load the extension into this database
>> >connection */
>> >  const char *zFile,    /* Name of the shared library containing
>> >extension */
>> >  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
>> >  char **pzErrMsg       /* Put error message here if not 0 */
>> >);
>> >
>> >What would be the path to use in Windows?  Thanks so much.
>
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Jose Isaias Cabrera-4
>
>

Keith Medcalf, on Tuesday, November 26, 2019 03:38 PM, wrote...
>
>
> What is the canonical name of the file you are trying to load?

c:\PMOProjects\libsqlite3decimal.dll

As shown by the dir command,

15:40:36.57>dir c:\PMOProjects\libsqlite3decimal.dll
 Volume in drive C is Windows
 Volume Serial Number is 40AA-E472

 Directory of c:\PMOProjects

11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
               1 File(s)        225,376 bytes
               0 Dir(s)  431,761,633,280 bytes free


> It seems that you are being told that "c:\PMOProjects\libsqlite3decimal.dll" does not exist.

But it is there,

15:40:48.95>dir c:\PMOProjects
 Volume in drive C is Windows
 Volume Serial Number is 40AA-E472

 Directory of c:\PMOProjects

11/26/2019  03:40 PM    <DIR>          .
11/26/2019  03:40 PM    <DIR>          ..
11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
11/25/2019  09:21 AM         3,446,300 PMOProjs.exe
11/22/2019  02:17 PM           926,748 PMOUpdater.exe
10/04/2019  11:30 AM           932,223 sqlite3.dll
               4 File(s)      5,530,647 bytes
               2 Dir(s)  431,760,363,520 bytes free

15:43:18.90>


> Are you sure that the file exists and that you have permission to read/execute it?

Aaaah, permissions... Hmmmm... I created this in cygwin, and copied it to that directory.  Let me try something...

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Jose Isaias Cabrera-4

Jose Isaias Cabrera, on Tuesday, November 26, 2019 03:44 PM, wrote...

> Keith Medcalf, on Tuesday, November 26, 2019 03:38 PM, wrote...
> > What is the canonical name of the file you are trying to load?
>
> c:\PMOProjects\libsqlite3decimal.dll
>
> As shown by the dir command,
>
> 15:40:36.57>dir c:\PMOProjects\libsqlite3decimal.dll
>  Volume in drive C is Windows
>  Volume Serial Number is 40AA-E472
>
>  Directory of c:\PMOProjects
>
> 11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
>                1 File(s)        225,376 bytes
>                0 Dir(s)  431,761,633,280 bytes free
>
>
> > It seems that you are being told that "c:\PMOProjects\libsqlite3decimal.dll" does not exist.
>
> But it is there,
>
> 15:40:48.95>dir c:\PMOProjects
>  Volume in drive C is Windows
>  Volume Serial Number is 40AA-E472
>
>  Directory of c:\PMOProjects
>
> 11/26/2019  03:40 PM   , on
> 11/26/2019  03:40 PM   , on
> 11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
> 11/25/2019  09:21 AM         3,446,300 PMOProjs.exe
> 11/22/2019  02:17 PM           926,748 PMOUpdater.exe
> 10/04/2019  11:30 AM           932,223 sqlite3.dll
>                4 File(s)      5,530,647 bytes
>                2 Dir(s)  431,760,363,520 bytes free
>
> 15:43:18.90>
>
>
> > Are you sure that the file exists and that you have permission to read/execute it?
>
> Aaaah, permissions... Hmmmm... I created this in cygwin, and copied it to that directory.  Let me try something...

Yes, I am the owner,
15:46:48.04>dir /Q C:\PMOProjects
 Volume in drive C is Windows
 Volume Serial Number is 40AA-E472

 Directory of C:\PMOProjects

11/26/2019  03:40 PM    <DIR>          BUILTIN\Administrators .
11/26/2019  03:40 PM    <DIR>          NT SERVICE\TrustedInsta..
11/26/2019  02:19 PM           225,376 AMER\e608313           libsqlite3decimal.dll
11/25/2019  09:21 AM         3,446,300 AMER\e608313           PMOProjs.exe
11/22/2019  02:17 PM           926,748 AMER\e608313           PMOUpdater.exe
10/04/2019  11:30 AM           932,223 AMER\e608313           sqlite3.dll
               4 File(s)      5,530,647 bytes
               2 Dir(s)  431,782,502,400 bytes free


I think there is a bug in the Windows tool.  I will keep trying until I get to the bottom of it.  Thanks.

josé
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Keith Medcalf
In reply to this post by Jose Isaias Cabrera-4

Ah, you have missing dependancies.  You need to make sure that the dependencies can be loaded.  When Windows attempts to load the module all the dependencies must be loaded as well, otherwise the loader cannot return a handle to the loaded module.  If no module handle is returned then the message "Module not found" is returned because sqlite3_load_extension does not actually check whether the module exists, but only whether or not it was loaded.

So if the module exists and you get the message that it was not found, that is because it could not be loaded ...

use depends.exe to see what other dll's are required and either put them on the path or in the same directory ...

--
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.

>-----Original Message-----
>From: sqlite-users <[hidden email]> On
>Behalf Of Jose Isaias Cabrera
>Sent: Tuesday, 26 November, 2019 13:45
>To: SQLite mailing list <[hidden email]>
>Subject: Re: [sqlite] Passing a path to sqlite3.exe to load a dll
>
>>
>>
>
>Keith Medcalf, on Tuesday, November 26, 2019 03:38 PM, wrote...
>>
>>
>> What is the canonical name of the file you are trying to load?
>
>c:\PMOProjects\libsqlite3decimal.dll
>
>As shown by the dir command,
>
>15:40:36.57>dir c:\PMOProjects\libsqlite3decimal.dll
> Volume in drive C is Windows
> Volume Serial Number is 40AA-E472
>
> Directory of c:\PMOProjects
>
>11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
>               1 File(s)        225,376 bytes
>               0 Dir(s)  431,761,633,280 bytes free
>
>
>> It seems that you are being told that
>"c:\PMOProjects\libsqlite3decimal.dll" does not exist.
>
>But it is there,
>
>15:40:48.95>dir c:\PMOProjects
> Volume in drive C is Windows
> Volume Serial Number is 40AA-E472
>
> Directory of c:\PMOProjects
>
>11/26/2019  03:40 PM    <DIR>          .
>11/26/2019  03:40 PM    <DIR>          ..
>11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
>11/25/2019  09:21 AM         3,446,300 PMOProjs.exe
>11/22/2019  02:17 PM           926,748 PMOUpdater.exe
>10/04/2019  11:30 AM           932,223 sqlite3.dll
>               4 File(s)      5,530,647 bytes
>               2 Dir(s)  431,760,363,520 bytes free
>
>15:43:18.90>
>
>
>> Are you sure that the file exists and that you have permission to
>read/execute it?
>
>Aaaah, permissions... Hmmmm... I created this in cygwin, and copied it to
>that directory.  Let me try something...
>
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Passing a path to sqlite3.exe to load a dll

Jose Isaias Cabrera-4

Ah-hah!

Keith Medcalf, on Tuesday, November 26, 2019 03:58 PM, wrote...
>
>
> Ah, you have missing dependancies.  You need to make sure that the
> dependencies can be loaded.  When Windows attempts to load the module
> all the dependencies must be loaded as well, otherwise the loader
> cannot return a handle to the loaded module.  If no module handle is
> returned then the message "Module not found" is returned because
> sqlite3_load_extension does not actually check whether the module
> exists, but only whether or not it was loaded.


> So if the module exists and you get the message that it was not found,
> that is because it could not be loaded ...
>
> use depends.exe to see what other dll's are required and either put
> them on the path or in the same directory ...


> >
> >Keith Medcalf, on Tuesday, November 26, 2019 03:38 PM, wrote...
> >>
> >>
> >> What is the canonical name of the file you are trying to load?
> >
> >c:\PMOProjects\libsqlite3decimal.dll
> >
> >As shown by the dir command,
> >
> >15:40:36.57>dir c:\PMOProjects\libsqlite3decimal.dll
> > Volume in drive C is Windows
> > Volume Serial Number is 40AA-E472
> >
> > Directory of c:\PMOProjects
> >
> >11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
> >               1 File(s)        225,376 bytes
> >               0 Dir(s)  431,761,633,280 bytes free
> >
> >
> >> It seems that you are being told that
> >"c:\PMOProjects\libsqlite3decimal.dll" does not exist.
> >
> >But it is there,
> >
> >15:40:48.95>dir c:\PMOProjects
> > Volume in drive C is Windows
> > Volume Serial Number is 40AA-E472
> >
> > Directory of c:\PMOProjects
> >
> >11/26/2019  03:40 PM   , on
> >11/26/2019  03:40 PM   , on
> >11/26/2019  02:19 PM           225,376 libsqlite3decimal.dll
> >11/25/2019  09:21 AM         3,446,300 PMOProjs.exe
> >11/22/2019  02:17 PM           926,748 PMOUpdater.exe
> >10/04/2019  11:30 AM           932,223 sqlite3.dll
> >               4 File(s)      5,530,647 bytes
> >               2 Dir(s)  431,760,363,520 bytes free
> >
> >15:43:18.90>
> >
> >
> >> Are you sure that the file exists and that you have permission to
> >read/execute it?
> >
> >Aaaah, permissions... Hmmmm... I created this in cygwin, and copied it to
> >that directory.  Let me try something...

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users