Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Adding DLL's to System Folder On Exe Startup

Adding DLL's to System Folder On Exe Startup

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studioquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jerry1211a
    wrote on last edited by
    #1

    I have a VS.net C++ Project that requires certain DLL's exist on the users system to run. As part of the project I would like to detect the users OS and install the dll's in the required system folder(s) when the user starts up the application. Can I do this or should I just create an installation disk to handle it? :) Thanks. Jerry

    K B 2 Replies Last reply
    0
    • J jerry1211a

      I have a VS.net C++ Project that requires certain DLL's exist on the users system to run. As part of the project I would like to detect the users OS and install the dll's in the required system folder(s) when the user starts up the application. Can I do this or should I just create an installation disk to handle it? :) Thanks. Jerry

      K Offline
      K Offline
      khan
      wrote on last edited by
      #2

      If you have statically linked your program to the dlls, then you will need an installation program I believe. If you are loading the dll files dynamically using LoadLibrary(...), then you can have the dll files in the exe as resources, and copy/install them onto the system if they are needed. this is this.

      B 1 Reply Last reply
      0
      • K khan

        If you have statically linked your program to the dlls, then you will need an installation program I believe. If you are loading the dll files dynamically using LoadLibrary(...), then you can have the dll files in the exe as resources, and copy/install them onto the system if they are needed. this is this.

        B Offline
        B Offline
        Bob Stanneveld
        wrote on last edited by
        #3

        khan++ wrote: If you have statically linked your program to the dlls, then you will need an installation program I believe. No, you cannot link statically to dynamic link libraries. SLL's are compiled libraries that will be linked together with your program. It will make your executable larger... DLL's however are linked to at runtime. When you run your program, DLL's can be loaded at startup, on demand or manual. This requires extra files (DLLs) to be shipped with your product. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

        K B 2 Replies Last reply
        0
        • J jerry1211a

          I have a VS.net C++ Project that requires certain DLL's exist on the users system to run. As part of the project I would like to detect the users OS and install the dll's in the required system folder(s) when the user starts up the application. Can I do this or should I just create an installation disk to handle it? :) Thanks. Jerry

          B Offline
          B Offline
          Bob Stanneveld
          wrote on last edited by
          #4

          Hello, Why would you wan't to place the DLL's in the system folder? Most people hate it when 3rd party libraries are placed in those folders.. Anyway, I think that it is better to make an installation disk and do some checks when the DLL's are needed. Don't install the DLL's when you detect an error, but inform the user and let him take appropriate actions. Make sure that you have the DLL's ready on your installation disk, so the user can copy them when he / she needs them. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

          B 1 Reply Last reply
          0
          • B Bob Stanneveld

            khan++ wrote: If you have statically linked your program to the dlls, then you will need an installation program I believe. No, you cannot link statically to dynamic link libraries. SLL's are compiled libraries that will be linked together with your program. It will make your executable larger... DLL's however are linked to at runtime. When you run your program, DLL's can be loaded at startup, on demand or manual. This requires extra files (DLLs) to be shipped with your product. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

            K Offline
            K Offline
            khan
            wrote on last edited by
            #5

            Bob Stanneveld wrote: DLL's however are linked to at runtime. ... Exactly. I used the wrong words. Thanks for the correction. :) this is this.

            1 Reply Last reply
            0
            • B Bob Stanneveld

              khan++ wrote: If you have statically linked your program to the dlls, then you will need an installation program I believe. No, you cannot link statically to dynamic link libraries. SLL's are compiled libraries that will be linked together with your program. It will make your executable larger... DLL's however are linked to at runtime. When you run your program, DLL's can be loaded at startup, on demand or manual. This requires extra files (DLLs) to be shipped with your product. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

              B Offline
              B Offline
              Blake Miller
              wrote on last edited by
              #6

              He probably should have said 'implicitly' linked to the DLL. Static Linkage - Traditional LIB files - MAkes EXE larger. Implicit Linkage - DLL Files - Exe not necessarily larger, but won't run if DLL cna not be found and loaded. Dynamic Linkage - DLL Files - Your EXE does LoadLibrary and GetProcAddress to load the DLL and call functions. With this method, your own EXE could possibly deploy DLL.

              1 Reply Last reply
              0
              • B Bob Stanneveld

                Hello, Why would you wan't to place the DLL's in the system folder? Most people hate it when 3rd party libraries are placed in those folders.. Anyway, I think that it is better to make an installation disk and do some checks when the DLL's are needed. Don't install the DLL's when you detect an error, but inform the user and let him take appropriate actions. Make sure that you have the DLL's ready on your installation disk, so the user can copy them when he / she needs them. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                B Offline
                B Offline
                Blake Miller
                wrote on last edited by
                #7

                Also, the OS hates it. The OS might hate it so much, that the user running the program will not even have access rights to copy files to the system folder! That is a lot of hate :~ You could put the folders into a location ALL users have access to and then investigate "App Paths" registry entries for your EXE(s) to set up that folder as a location where DLL will be searched for loading.

                B 1 Reply Last reply
                0
                • B Blake Miller

                  Also, the OS hates it. The OS might hate it so much, that the user running the program will not even have access rights to copy files to the system folder! That is a lot of hate :~ You could put the folders into a location ALL users have access to and then investigate "App Paths" registry entries for your EXE(s) to set up that folder as a location where DLL will be searched for loading.

                  B Offline
                  B Offline
                  Bob Stanneveld
                  wrote on last edited by
                  #8

                  I think that developers should keep the DLL's in the application folder. I really hate to see one application have different folders in multiple system folders. IMHO one should set a registry key for a DLL that is installed and applications should check that DLL before installing, etc., etc.. This way, the files are manageble by the user. Also this technique allows different versions of DLL's with the same name to exist on the same system, thus avoiding DLL hell! Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups