DLL Redirect

This is a discussion on DLL Redirect within the Windows Programming forums, part of the Platform Specific Boards category; I'm kinda new too dll programming. Is there a way to redirect a dll? For example when a program loads ...

  1. #1
    username
    Guest

    DLL Redirect

    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.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    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);

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    What are you trying to achieve?

  4. #4
    Username
    Guest
    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.

  5. #5
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    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
    Code:
    HANDLE h = LoadLibraryEx(".\\plugins\\codec1.dll", NULL,
        LOAD_WITH_ALTERED_SEARCH_PATH);
    You'd use FreeLibrary() to clean up when you are done.

    [edit]
    You may need a full path for the first parameter in LoadLibraryEx()
    [/edit]

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 08:11 AM
  2. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 03:20 AM
  3. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 01:34 PM
  4. Using class with DLL
    By greg2 in forum C++ Programming
    Replies: 2
    Last Post: 09-12-2003, 06:24 AM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21