I want to open a database and create a container (set) in the global scope so that I can access it from all functions with the following code:
DbEnv* penv = open_env(".", 0u, DB_INIT_MPOOL | DB_CREATE);
Db* db = open_db(penv, "test.db", DB_BTREE, DB_CREATE, 0u);
db_set<unsigned long long, ElementHolder<unsigned long long>> testSet(db, penv);
This working, if I write this inside the main function (or any other function), but if I place this code in global scope (or even I specify only testSet in the global scope, and then inside any function I open the database and "associate" testSet with it), program crashes with this message: exited with code -1073741819