Click here to Skip to main content
15,925,250 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If I want to use LoadLibrary I must know the interface before and AfxLoadLibrary needs C++. Is there some way to use pure C?

And so what's than differemce between loadtime static imported dll and runtime imported any other than that on loadtime one can't handle versions?

It is plugin system onload I don't know which plugins will be loaded?
Posted
Updated 1-Mar-13 23:18pm
v2
Comments
Sergey Alexandrovich Kryukov 1-Mar-13 18:53pm    
Not clear. Could you show these two cases in code?
In principle, you can use C. If this is an exported C++ class, it can be pretty difficult, but such use is not very usual.
If "you don't know the interface before", what could you do with a library after you load it? You need to know it. Next step would be GetProcAddress.
—SA

LoadLibrary[^] works fine in C or C++.

As to the rest of your question, I am not really sure what your problem is.
 
Share this answer
 
The difference between statically loading a DLL and LoadLibrary is that in the first case the DLL must be present at the time your executable is started. So you must know at the time of programming that it exists.

In case of LoadLibrary, your program may learn about a DLL at runtime, for example by reading a configuration file with your plugins. It can then load the DLL via LoadLibrary. Nevertheless, your program must at least know tne name or ordnial numbers and calling convention of some procedures of the loaded DLL to get access to them via GetProcAddress.
 
Share this answer
 
Maybe my question is unclear, but I can use

C#
typedef void* (*unknown)(
#ifdef __cplusplus
...
#endif
);


and retype load with unknown everithings works fine then.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900