Resolving a symbol in memory
-
wrote on 3 Nov 2011, 10:51 last edited by
Hi,
My problem is the following: I have a Qt application that depends on a shared library. Thus, this shared library is automatically loaded in memory when my application starts.
Now, I want to check for a symbol in this library (which doesn't only depends on the library version). How can I do ?
When I use QLibrary, I have to call 'QLibrary::load' to resolve the symbol but the library is supposed to be already loaded. Isn't it possible to query the symbols available in memory ?Dominique
-
wrote on 3 Nov 2011, 10:57 last edited by
Why would the symbols be available in memory if your application already got the relevant pointers at the link stage?
There's a good possibility that QLibrary::load() won't actually load the library again. It just needs to know about the exported symbols. I'm not sure though. Did you try and see what the results were?
-
wrote on 3 Nov 2011, 11:08 last edited by
bq. Why would the symbols be available in memory if your application already got the relevant pointers at the link stage?
actually it doesn't since I don't make an explicit reference to the symbol and I want to avoid that. It's a kind of dynamic weak link.
bq. There’s a good possibility that QLibrary::load() won’t actually load the library again. It just needs to know about the exported symbols. I’m not sure though. Did you try and see what the results were?
I though about that possibility (library not loaded again) but how can I check ?
-
wrote on 3 Nov 2011, 11:09 last edited by
So you're just dynamically linking?
-
wrote on 3 Nov 2011, 11:15 last edited by
yes, but only partially since the other symbols are resolved the usual way.
Actually I don't want the application to issue a link error at run time for a specific symbol (which I can safely ignore when not present - I simply disable the corresponding feature) -
wrote on 3 Nov 2011, 11:16 last edited by
libraries are loaded with some kind of ref counting. It is safe to load them twice, but take care to also release them twice. Otherwise they are removed only at the end of the application.
-
wrote on 3 Nov 2011, 11:21 last edited by
ok
thanks, that should solve my problem.
1/7