Reputation: 327
Suppose I have
In main.exe,
int main()
{
if(1)
{
functionA();
}
else
{
functionB();
}
}
Suppose I do not have dllB but only dllA and I still want to launch the application main.exe.
Is there any way I can bypass the DLL check right at the launch of main.exe so I can still start the application without dllB?
Upvotes: 0
Views: 72
Reputation: 6588
Do not specify the DLL as dependency. You can then use this code to dynamically load functions:
HMODULE libA = LoadLibrary("dllA.dll"); // NULL if load failed
HMODULE libB = LoadLibrary("dllB.dll"); // NULL if load failed
void (*functionA)(void) = libA ? GetProcAddress(libA,"functionA"):NULL;
void (*functionB)(void) = libB ? GetProcAddress(libB,"functionB"):NULL;
Upvotes: 2
Reputation: 96119
At least on windows you can explictly load the dll at runtime with Loadlibrary
edit: It returns NULL if the DLL isn't found or can't be loaded
Upvotes: 1