I`m trying to write an application which loads DLL based on user actions (eg. skins). But how can I do it? I must link a static library with my app, but at the moment of compilation I don`t know which of them user selects?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You won't have to link with them. When you call LoadLibrary it should return a handle to the DLL. Then a call to GetProcAddress will give you a address to the exported function that you want to call.
The winAPI32.hlp is not quite clear for me.
It's often the problem, that DLL's are loaded automaticly *bevor* program execution.
Is there a (linking) option to prevent loading DLL's at the start of the program? the references have to be solved anyway at compiletime?
For example I have a GTK+ program, but if I run it without GUI, I'd like to run the program without the GUI-DLL's...
Patrick
P.S.
I made a lot of research, but I didn't find a good link, which explains that problem exactly.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I`m trying to write an application which loads DLL based on user actions (eg. skins). But how can I do it? I must link a static library with my app, but at the moment of compilation I don`t know which of them user selects?
Hi!
There's another way to load DLLs at runtime using the Win API. Search the API for LoadLibrary or LoadLibraryEx.
I thought, that if I load DLL using LoadLibrary (Ex) I still need link with that static lib (.a), don`t I?
You won't have to link with them. When you call LoadLibrary it should return a handle to the DLL. Then a call to GetProcAddress will give you a address to the exported function that you want to call.
Check this out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/using_run_time_dynamic_linking.asp
The winAPI32.hlp is not quite clear for me.
It's often the problem, that DLL's are loaded automaticly *bevor* program execution.
Is there a (linking) option to prevent loading DLL's at the start of the program? the references have to be solved anyway at compiletime?
For example I have a GTK+ program, but if I run it without GUI, I'd like to run the program without the GUI-DLL's...
Patrick
P.S.
I made a lot of research, but I didn't find a good link, which explains that problem exactly.