CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 1999
    Posts
    66

    Exclamation Start an Application used DLLs from other directory.

    Hi,

    I have the following situation: the main executable is in a folder and some dlls - linked to the exe - are in other folder. They are needed to start the exe. Somthing like:
    InstallFolder\Bin
    InstallFolder\Lib
    InstallFolder\Shared
    The application is in "Bin", DLLs in "Lib". If I extend the system path (PATH) with "..\InstallFolder\Lib" all works perfect. The problem is: the philosophy of my company is to NOT write anything in the customer system path, registry, etc.
    So: is it possible to make known the folder ..\InstallFolder\Lib to the application in "InstallFolder\Bin". E.g. you can do this if you starts an application from another (SetEnvironment) and the system path is clean. But in this case that's the application (or if needed the link) the user starts. That means the application must look not only in the current directory and in the PATH, but also in my InstallFolder\Lib.
    For any idea thanks in advance.

    Regards,
    Emil

  2. #2
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Start an Application used DLLs from other directory.

    Generally application DLLs are placed in either application' current directory or in one of standard directories (which are part of %PATH% ).

    In case you absulutely need this, other than appending one more string to PATH variable, you can try dynamic loading of your DLL. For this you need to call LoadLibrary, and pass absolute or relative path of DLL location.

    Dynamic loading has its own implications. It should be used only when specific functionality is needed at later time of execution. For instance backup program or a game utility within your application.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Start an Application used DLLs from other directory.

    I believe it might be cheated with special launcher application. It will run and first modify its own environment and then start main app which inherits parent's modified environment.

    I'd like to say that the philosophy of your company should obey to common rules - either in aspect of module placing or in aspect of environvent adjustment. Breaking all rules would be painful too much.
    Attached Files Attached Files
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured