PDA

View Full Version : dll again..



triperzz
16th February 2008, 07:20
guys i want to create a .dll file that has its own window so that if i call the dll it will create its own window (like eula license for example)..

im having a bit of trouble doing it, my question is how can i export the object (Dialog), for example just show the ui in a single function without class

i can export functions using extern "C" Q_DECL_EXPORT, next question is how can i export the class::functions, if i export the class can i already access its functions? how? should i access the classname::functionname or functionname only?

note:"im avoiding to use the #include mydll.h i want my dll to be independent, i only call the dlls"

jacek
18th February 2008, 00:15
i can export functions using extern "C" Q_DECL_EXPORT, next question is how can i export the class::functions, if i export the class can i already access its functions? how? should i access the classname::functionname or functionname only?
It's not that easy, if you don't want to use a header file. The exact name depends on name mangling scheme of your compiler. You can use Dependency Walker (http://www.dependencywalker.com/) to look up the symbols.


im avoiding to use the #include mydll.h i want my dll to be independent, i only call the dlls"
The header file tells the compiler how the class looks like and this make accessing it much easier. Just make sure that the header contains only the interface.

vladeck
19th February 2008, 22:48
What you can do is create base class (abstract) - something like MyPlugin, and then create implementations of the things you want in .dll using MyPlugin as base class. MyPlugin would have at least two exported functions - one for creating object of type MyPlugin, another for destroying it. Then, you could manualy load .dll using QLibrary, and use custom implementations of your 'plugins'... you would only need to include MyPlugin.hpp wich is abstract. If this doesn't make much sense to you, maybe I'll try to do some code examples next time?