Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Jacek Oleksy
Igor Tandetnik wrote:

> Is this DLL statically linked to SQLite, or itself uses sqlite3.dll?
> 

This DLL is statically linked to SQLite.

> 
> If you have several modules, each statically linked with SQLite, then 
> you have multiple copies of SQLite runtime in the same process. This is 
> a recipe for disaster. Such configuration can only works if modules' 
> usage of SQLite is completely isolated: they don't pass SQLite resources 
> (e.g. connectionn or statement handles) across module boundaries, and 
> they don't attempt to work against the same database file at the same 
> time.
> 
> Would it be possible to get all modules to use SQLite DLL? Then all your 
> problems will go away.
> 

I will try this. Thanks for help!

Best regards,
Jacek
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Igor Tandetnik
"Jacek Oleksy" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> Hello,
> I'm using VC++.NET 2003 & Windows XP SP2.
> I have following problem with version 3.6.0:
>
> sqlite configuration is being hold in a global variable sqlite3Config.
>
> My application uses a dll, which initializes sqlite database. Dll's
> copy of the sqlite3Config variable is initialized properly and sqlite
> calls from inside the dll work fine.

Is this DLL statically linked to SQLite, or itself uses sqlite3.dll?

> However, the main module's copy of sqlite3Config is still empty and
> when I try to use the database from the main module a crash occurs in
> sqlite3_mutex_enter. It can be avoided by initializing sqlite in main
> module (e.g. by opening a database and closing it).
>
> The question is: can I use one database connection (one sqlite3
> pointer) in multiple modules? In such case database operations from
> main module and from dll will be using different sqlite3Config
> variables, is it safe?

If you have several modules, each statically linked with SQLite, then 
you have multiple copies of SQLite runtime in the same process. This is 
a recipe for disaster. Such configuration can only works if modules' 
usage of SQLite is completely isolated: they don't pass SQLite resources 
(e.g. connectionn or statement handles) across module boundaries, and 
they don't attempt to work against the same database file at the same 
time.

Would it be possible to get all modules to use SQLite DLL? Then all your 
problems will go away.

Igor Tandetnik 



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


Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Jacek Oleksy
Jacek Oleksy wrote:
> sqlite configuration is being hold in a global variable sqlite3Config.

To be more specific: this variable is used by sqlite internally, it is 
defined in global.c. That's why I'm not sure what to do with it...

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


Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Jacek Oleksy
By 'module' I mean any dll loaded by the application or the application 
itself. I know the data is not shared, hence my question: can I use one 
database connection (one sqlite3 pointer) in multiple modules?

Regards,
Jacek

Roberto pisze:
> You need to clarify what you mean by 'module'. Data is not shared in
> DLL's (sperate memory space and all that..), each calling application
> will need their own copy of data initialized by a shared library. If
> you have a global variable in a dll and need to share this data across
> multiple processes, then you need to look into memory mapped files.

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


Re: [sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Roberto
You need to clarify what you mean by 'module'. Data is not shared in
DLL's (sperate memory space and all that..), each calling application
will need their own copy of data initialized by a shared library. If
you have a global variable in a dll and need to share this data across
multiple processes, then you need to look into memory mapped files.

2008/7/25 Jacek Oleksy <[EMAIL PROTECTED]>:
> Hello,
> I'm using VC++.NET 2003 & Windows XP SP2.
> I have following problem with version 3.6.0:
>
> sqlite configuration is being hold in a global variable sqlite3Config.
>
> My application uses a dll, which initializes sqlite database. Dll's copy
> of the sqlite3Config variable is initialized properly and sqlite calls
> from inside the dll work fine.
>
> However, the main module's copy of sqlite3Config is still empty and when
> I try to use the database from the main module a crash occurs in
> sqlite3_mutex_enter. It can be avoided by initializing sqlite in main
> module (e.g. by opening a database and closing it).
>
> The question is: can I use one database connection (one sqlite3 pointer)
> in multiple modules? In such case database operations from main module
> and from dll will be using different sqlite3Config variables, is it safe?
>
> Other solution is to perform all sqlite operations in one module or to
> open new db connection for each module.
> And btw: v3.5.9 works fine...
>
> Am I missing something here? Please correct me if I'm wrong...
>
> Thanks,
> Jacek
> ___
> 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


[sqlite] Sqlite 3.6.0 across dll

2008-07-25 Thread Jacek Oleksy
Hello,
I'm using VC++.NET 2003 & Windows XP SP2.
I have following problem with version 3.6.0:

sqlite configuration is being hold in a global variable sqlite3Config.

My application uses a dll, which initializes sqlite database. Dll's copy 
of the sqlite3Config variable is initialized properly and sqlite calls 
from inside the dll work fine.

However, the main module's copy of sqlite3Config is still empty and when 
I try to use the database from the main module a crash occurs in 
sqlite3_mutex_enter. It can be avoided by initializing sqlite in main 
module (e.g. by opening a database and closing it).

The question is: can I use one database connection (one sqlite3 pointer) 
in multiple modules? In such case database operations from main module 
and from dll will be using different sqlite3Config variables, is it safe?

Other solution is to perform all sqlite operations in one module or to 
open new db connection for each module.
And btw: v3.5.9 works fine...

Am I missing something here? Please correct me if I'm wrong...

Thanks,
Jacek
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users