I'm kinda new too dll programming. Is there a way to redirect a dll? For example when a program loads it, it will redirect to another dll.
I'm kinda new too dll programming. Is there a way to redirect a dll? For example when a program loads it, it will redirect to another dll.
So what you want to do, is to link another dll from the one that you're making?
You do this the same way you're linking your dll from the app:
HANDLE h1 = LoadLibrary("DllName");
if(h1)
LoadFunctionsFromDll(h1);
What are you trying to achieve?
Well this program starts it loads all the dlls in it's plugin directory. I have many plugins some with the same name so I need some in another folder.
I'm not sure if this is what you mean, but I had started a thread a while back because I needed to access dll's that were in a different folder. As it turns out LoadLibraryEx() will accomplish that task.
Example
You'd use FreeLibrary() to clean up when you are done.Code:HANDLE h = LoadLibraryEx(".\\plugins\\codec1.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
[edit]
You may need a full path for the first parameter in LoadLibraryEx()
[/edit]
LoadLibrary searches in predefined folders (current, windows,system...etc) but it also visits directories as listed in the PATH environment variable.....they add the dir to the PATH line and see if it works