Installing Dlls
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Thread: Installing Dlls

Hybrid View

  1. #1
    Join Date
    Sep 2003
    Location
    Argentina....
    Posts
    118

    Installing Dlls

    Hi,
    i'm useing the install shield for vc++ 6.0, and i can't install a shared dll like the mfc40.dll.... know anyone how i can do this???

    Thanks in advance,
    Diego
    My history: QB->VB->TC++->VB->VC++->VC#

  2. #2
    Join Date
    Nov 2003
    Posts
    13
    If I did not know if the target machine has had the same version of mfc DLL, I usually put it in the application directory, and the application will use the the file.

    I am not sure what you mean by shared mfc dll, is it shared by your app(s) or is it shared by your app(s) and some other applications?

    Hope this can call some other suggestions.

    csheng

  3. #3
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,051
    Usually, you must not redistribute the release versions of MFC DLLs (as mfc40.dll),
    because they are already in the system directory since the OS install.
    Although, in case it's necessary (e.g. mfc70.dll or msvcr70.dll),
    better is to put them in the application directory, as csheng already said.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  4. #4
    Join Date
    Apr 2000
    Location
    Romania, Cluj-Napoca
    Posts
    57
    I agree on the idea that the best way is to copy the necessary DLLs in the current folder of the application. That's guarateed that the DLL from the app. directory will be used when using the LoadLibrary() function.

    However I do not agree with the idea , I quote: "Usually, you must not redistribute the release versions of MFC DLLs (as mfc40.dll),
    because they are already in the system directory since the OS install." I built many installation kits and on older OS'es, especially when the OS is freshly installed, U DO NOT HAVE MFC40.DLL installed.

    I have a suggestion however to make your work easier. I use InstallShield 6.3 which is coming with a bunch of predefined objects: OLE DB, MFC 6.2, ODBC 3.51 that u can insert them in the project. Those objects will do the painful work that u normally do: check the version of MFC40.DLL for example, deciding if it replaces it or not , registering it , etc.
    Actually u create first a component and in that component u insert the object that u want. The objects are installing a certain technology as u may see in the explenations before. All your responsability is then to check the errors that can occur during the installation, but this can be done easily. In addition to that the InstallShield 6.3 is event based, so that u can split logically the actions.

    RATE ME OR HATE ME

  5. #5
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by nick666
    I agree on the idea that the best way is to copy the necessary DLLs in the current folder of the application. That's guarateed that the DLL from the app. directory will be used when using the LoadLibrary() function.
    This is not always true. Search for SafeDLLSearchMode in MSDN. Granted, it is only for newer OSs, but it should be noted...
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  6. #6
    Join Date
    Oct 2003
    Location
    Romania
    Posts
    127
    Originally posted by vicodin451
    This is not always true. Search for SafeDLLSearchMode in MSDN. Granted, it is only for newer OSs, but it should be noted...
    Truly newer OS: Windows XP.
    Possible will be also present in Windows Longhorn .

  7. #7
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by marsh_pottaye
    Truly newer OS: Windows XP.
    Possible will be also present in Windows Longhorn .
    XP is already 2 years old, I might say.
    Nonetheless, the whole blurb from MSDN (from the LoadLibrary doc), since it might appear that someone is using an older version...
    Windows Server 2003, Windows XP SP1: The default value of HKLM\System\CurrentControlSet\Control\Session Manager\SafeDllSearchMode is 1 (current directory is searched after the system and Windows directories).


    Windows XP: If HKLM\System\CurrentControlSet\Control\Session Manager\SafeDllSearchMode is 1, the current directory is searched after the system and Windows directories, but before the directories in the PATH environment variable. The default value is 0 (current directory is searched before the system and Windows directories).
    The SetDllDirectory function is also mentioned.
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  8. #8
    Join Date
    Apr 2000
    Location
    Romania, Cluj-Napoca
    Posts
    57

    Agreed, but .....

    I quote from MSDN:
    "The directory from which the application loaded.
    The current directory.
    Windows 95/98: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
    Windows NT/ 2000: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is SYSTEM32.

    Windows NT/ 2000: The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is SYSTEM.
    The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
    The directories that are listed in the PATH environment variable. "

    This is the sequence of paths searched by the LoadLibrary() API to load a DLL. Even if SafeDllSearchMode is set to 1, the first path to be searched is , I quote again: "The directory from which the application loaded." The current directory might be diffrent from the application directory. So, in my understanding, if u put the DLL in the same directory with the app, it should work regardless the value of SafeDllSearchMode.

  9. #9
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515

    Red face Re: Agreed, but .....

    Originally posted by nick666
    Even if SafeDllSearchMode is set to 1, the first path to be searched is , I quote again: "The directory from which the application loaded."
    You are correct, of course.

    In my defense, I'm suffering from caffeine deprivation...

    Actually, I had a situation in mind where I was "bitten" by SafeDLLSearchMode, that I was thinking was similar to this, but it is not.
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  10. #10
    Join Date
    Apr 2000
    Location
    Romania, Cluj-Napoca
    Posts
    57
    You are correct, of course.
    I will make a test today by simple curiosity and maybe later I will be grateful for u I will tell u the results.

  11. #11
    Join Date
    Sep 2003
    Location
    Argentina....
    Posts
    118
    thanks, but if i put the mfc40.dll in the application directory, it doesn't work, is it??
    My history: QB->VB->TC++->VB->VC++->VC#

  12. #12
    Join Date
    Sep 2003
    Location
    Forever Gone... For Now...
    Posts
    1,515
    Originally posted by diegojancic
    thanks, but if i put the mfc40.dll in the application directory, it doesn't work, is it??
    It should. Try it and see. Not sure what dependencies MFC40.DLL has... Get DependencyWalker from www.DependencyWalker.com to find out...
    Thought for the day/week/month/year:
    Windows System Error 4006:
    Replication with a nonconfigured partner is not allowed.

  13. #13
    Join Date
    Nov 2003
    Posts
    13
    We should also make sure other dll (if any) using the same mfc dll are in the same spot.

    csheng

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center