Do not worry about DLL calls in Windows. They are ultra easy to be used. Just some ways:
- If you have the adecuate .lib file you can include them in the linking process
- You can use U++ DLI files.
- If you want low level direct control, you can call them directly. Here is the code of class Dl in U++/Bazaar/Functions4U library:
class Dl {
public:
Dl::Dl() {
hinstLib = 0;
}
Dl::~Dl() {
if (hinstLib)
if (FreeLibrary(hinstLib) == 0)
throw Exc(t_("Dl cannot be released"));
}
bool Dl::Load(const String &fileDll) {
if (hinstLib)
if (FreeLibrary(hinstLib) == 0)
return false;
hinstLib = LoadLibraryEx(TEXT(fileDll), NULL, LOAD_IGNORE_CODE_AUTHZ_LEVEL);
if (!hinstLib)
return false;
return true;
}
void *Dl::GetFunction(const String &functionName) {
if (!hinstLib)
return NULL;
return (void *)GetProcAddress(hinstLib, functionName);
}
private:
HINSTANCE hinstLib;
};
With Load() you open the DLL file and with GetFunction() you get the pointer to the function