hiho@ll
i use dlopen to load a shared library
everything works perfectly until i use static member variables in my classes which are getting loaded by dlopen
the problem:
this works:
Code:
class example{
int variable;
example();
};
this not:
Code:
class example{
static int variable;
example();
};
from dlopen i get:
./../lib/libmylibrary.so.0: undefined symbol: _ZN6example11variableE
i didn't really found a topic why there should be a problem with static variables and
this says u could use dlsym to get a pointer to a static variable
is shared library and static member variables a contradiction in terms?
or why does this not work?
maybe i forgot some compiler flag:
i use this for the library
g++ ./../utils/module.cpp -I./../utils/ -Wl,-export-dynamic -shared -o ./../lib/libmylibrary.so.0 \
-lpthread -lmysqlclient -I/usr/include/mysql -L/usr/lib/mysql -I./../utils \
-I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq example.cpp
and this for my main prog which loads the library:
g++ -I./../utils/ -ldl -rdynamic -Wall -lmysql -L/usr/lib/mysql -I./../utils \
-I/usr/local/pgsql/include -L/usr/local/pgsql/lib -lpq -o ./main main.cpp
gdb didn't give any hint on this
and i don't think it could
thx@ll