[Qt-interest] How to View Classes and Functions inside .so library file
Till Oliver Knoll
till.oliver.knoll at gmail.com
Wed Oct 19 09:00:02 CEST 2011
Am 19.10.2011 um 07:17 schrieb "Kamatchi Lakshmanan -ERS, HCL Tech" <kamatchi-l at hcl.com>:
> Is there any method in QT ( QLibrary / QPluginLoader) to view class and method names .
I don't think so. With QLibrary you have to /know/ the names of symbols you want to resolve:
http://doc.trolltech.com/4.7/qlibrary.html#resolve
IIRC QPluginLoader loads plugins which were created with the "Qt plugin framework", hence they (the plugins) follow certain naming conventions (such as they export e.g. a symbol "create" which instantiates the plugin).
Now what you're after is not only platform-dependent, but might be even compiler-dependent. Now C-style functions should be exported the same way across e.g. compilers on Windows, but not sure what happens to exported C++ classes. Maybe you would still be able to extract those symbols, but would get different names due to different name mangling between compilers?
Anyway, what are you trying to achieve? Do you really want to display those values (or process them in your application) such as developer tools like Dependency Walker?
Or do you merely want to figure out at runtime, given a plugin, what symbol to call to create it (by randomly calling those symbols, doh! Or with some name matching maybe? ;)
In the first case you could always execute a process and on e.g. Mac call "nm" (see man page) and similar tools on Linux (I think nm as well) and Windows (I googled "dumpbin /exports").
For the later I highly recommend QPluginLibrary with proper interfaces ;)
Cheers, Oliver
More information about the Qt-interest-old
mailing list