Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlite-almagamation with embedded python3 #5

Open
pipiche38 opened this issue Sep 24, 2020 · 2 comments
Open

sqlite-almagamation with embedded python3 #5

pipiche38 opened this issue Sep 24, 2020 · 2 comments
Labels

Comments

@pipiche38
Copy link

This is more a question than an issue.

Python3 can be embedded in a C/C++ code and so forth can execute python3 code which use sqlite3.

In case we have a C/C++ code using SQLite3-almagamation and at the same time we have python3 calling SQLite via the shared library is the code safe ?

In other words don't we have a risk of conflict between the 2 same code ?

@azadkuh
Copy link
Owner

azadkuh commented Sep 26, 2020

I'm sorry i have no experience in embedding python in c or c++, but I tried lua and c++ for a quick test, as lua uses the default *.so provided by OS, and the c++ uses this static sqlite-amalgamation with no problem.

This repo has a different include/lib path than system-wide sqlite, so your c/c++ will never get confused. I guess that you need to explicitly wrap these static functions into lua (or perhaps python) to use them there.

BTW you may want to trace/debug the sqlite functions to find out which version is being called.

@SylvainPer
Copy link

I try to trace what is happening with @pipiche38 issue.

I got this trace:
dz_plantage_thread_plugin
We can see that Plugins.cpp asks for python code execution, which leads to pysqlite and the libsqlite3.so before the embedded sqlite-almagamation.
On my tests, it only appears after the database creation on a 'SELECT * FROM '.
There is a segmentation fault because some parameters are not correctly initialized when running sqlite-almagamation, probably done in libsqlite3.so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants