I have some dll (namely, a dll from Qt framework) and I want to load and use it at runtime. I know how to load it - with LoadLibrary
I got a handle to this dll. But what next? Let's say, I want to use a class QString
that is inside this library - how can I export it? Is it possible at all?
Asked
Active
Viewed 191 times
0

nikitablack
- 4,359
- 2
- 35
- 68
-
1Nope, you cannot do that with `LoadLibrary`. You need to link to the Qt runtime in the standard way, with load time linking. – David Heffernan Apr 22 '15 at 13:15
-
Thank you. And can you explain why? – nikitablack Apr 22 '15 at 13:18
-
2LoadLibrary/GetProcAddress is for non-member functions rather than classes. Exporting classes requires support from the compiler and it's only viable with load time linking. – David Heffernan Apr 22 '15 at 13:22
-
1Although, if you don't want a load-time hard dependency, you can take a soft dependency instead by using delay-load, which is also managed by the toolchain, but allows you to recover from a missing DLL. – Ben Voigt Apr 22 '15 at 14:12