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. .NET (Core and Framework)
  4. Are DLLs redundant in .NET?

Are DLLs redundant in .NET?

Scheduled Pinned Locked Moved .NET (Core and Framework)
discussioncsharphelpquestion
42 Posts 8 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.
  • C Offline
    C Offline
    CatchExAs
    wrote on last edited by
    #1

    Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

    Richard DeemingR L P P D 7 Replies Last reply
    0
    • C CatchExAs

      Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      CatchExAs wrote:

      But an executable has some obvious benefits,

      Like what? :confused: The only "benefit" an executable has over a library is that it can be executed directly. For the vast majority of class libraries, executing them doesn't make any sense. For example, what would you expect to happen if you executed mscorlib? System.Data? Etc.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      C 1 Reply Last reply
      0
      • C CatchExAs

        Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        CatchExAs wrote:

        Can anyone think of a technical reason why you'd choose to build a library over an executable?

        ..because the code is not an executable; that's the reason I did not include an entry point. If I put a logger into a separate assembly, I can easily swap it with another, without ever touching the executable. The logger-class does not need to run independently of the main executable. Same goes for most code. And yes, I've got some private projects where I use executables as if they are DLL's; it's just a collection of code after all.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        • C CatchExAs

          Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          One thing I have considered (but never actually done) is to have a library as an EXE so it can print out documentation (to the console) and maybe allow testing and demoing the functions contained therein. <aside> In OpenVMS, the analog of a DLL is a "shared executable", which generally has an EXE extension. </aside>

          C 1 Reply Last reply
          0
          • C CatchExAs

            Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            So, how are you going to share your reusable code? Executables? Or are you going to cut and paste? Oh, and if you're adding a reference to something like a standard .NET assembly guess what, that's a DLL? Simply, a DLL is a convenient way to share functionality.

            P 1 Reply Last reply
            0
            • C CatchExAs

              Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples. Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of? Thoughts?

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Why would you want to make your code monolithic by including it in larger .EXE's, thereby increasing load time? Why would you want to give the users the ability to launch a "library" .EXE that does nothing but return to the command prompt?

              A guide to posting questions on CodeProject

              Click this: Asking questions is a skill. Seriously, do it.
              Dave Kreskowiak

              P C 2 Replies Last reply
              0
              • P PIEBALDconsult

                One thing I have considered (but never actually done) is to have a library as an EXE so it can print out documentation (to the console) and maybe allow testing and demoing the functions contained therein. <aside> In OpenVMS, the analog of a DLL is a "shared executable", which generally has an EXE extension. </aside>

                C Offline
                C Offline
                CatchExAs
                wrote on last edited by
                #7

                My thinking was along similar lines i.e. writing small executables that did one thing but did it well a la UNIX. Except I would require that the default behaviour of a main() function was to run a test suite embedded in the assembly.

                L 1 Reply Last reply
                0
                • Richard DeemingR Richard Deeming

                  CatchExAs wrote:

                  But an executable has some obvious benefits,

                  Like what? :confused: The only "benefit" an executable has over a library is that it can be executed directly. For the vast majority of class libraries, executing them doesn't make any sense. For example, what would you expect to happen if you executed mscorlib? System.Data? Etc.


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  C Offline
                  C Offline
                  CatchExAs
                  wrote on last edited by
                  #8

                  What if you required that they tested and verified themselves?

                  D 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Why would you want to make your code monolithic by including it in larger .EXE's, thereby increasing load time? Why would you want to give the users the ability to launch a "library" .EXE that does nothing but return to the command prompt?

                    A guide to posting questions on CodeProject

                    Click this: Asking questions is a skill. Seriously, do it.
                    Dave Kreskowiak

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    Dave Kreskowiak wrote:

                    make your code monolithic by including it in larger .EXE's

                    That's not what he means.

                    D 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      So, how are you going to share your reusable code? Executables? Or are you going to cut and paste? Oh, and if you're adding a reference to something like a standard .NET assembly guess what, that's a DLL? Simply, a DLL is a convenient way to share functionality.

                      P Offline
                      P Offline
                      PIEBALDconsult
                      wrote on last edited by
                      #10

                      Pete O'Hanlon wrote:

                      how are you going to share your reusable code?

                      The same way, but as an EXE with some sort of helpful library-specific functionality in the main. :shrug:

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Dave Kreskowiak wrote:

                        make your code monolithic by including it in larger .EXE's

                        That's not what he means.

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #11

                        I know. I was just pointing out that some people can go overboard with the ILMerge tool and end up making an .EXE that's 10's or 100's of MB in size. Then they wonder why it takes so long to load.

                        A guide to posting questions on CodeProject

                        Click this: Asking questions is a skill. Seriously, do it.
                        Dave Kreskowiak

                        L 1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          Why would you want to make your code monolithic by including it in larger .EXE's, thereby increasing load time? Why would you want to give the users the ability to launch a "library" .EXE that does nothing but return to the command prompt?

                          A guide to posting questions on CodeProject

                          Click this: Asking questions is a skill. Seriously, do it.
                          Dave Kreskowiak

                          C Offline
                          C Offline
                          CatchExAs
                          wrote on last edited by
                          #12

                          I wouldn't want to do either and nothing about my question implies I would.

                          D 1 Reply Last reply
                          0
                          • C CatchExAs

                            What if you required that they tested and verified themselves?

                            D Offline
                            D Offline
                            Dave Kreskowiak
                            wrote on last edited by
                            #13

                            What do you mean by "tested and verified themselves"??

                            A guide to posting questions on CodeProject

                            Click this: Asking questions is a skill. Seriously, do it.
                            Dave Kreskowiak

                            C 1 Reply Last reply
                            0
                            • C CatchExAs

                              I wouldn't want to do either and nothing about my question implies I would.

                              D Offline
                              D Offline
                              Dave Kreskowiak
                              wrote on last edited by
                              #14

                              By wrapping everything in an executable you're just adding extra dead weight.

                              A guide to posting questions on CodeProject

                              Click this: Asking questions is a skill. Seriously, do it.
                              Dave Kreskowiak

                              C L 2 Replies Last reply
                              0
                              • D Dave Kreskowiak

                                What do you mean by "tested and verified themselves"??

                                A guide to posting questions on CodeProject

                                Click this: Asking questions is a skill. Seriously, do it.
                                Dave Kreskowiak

                                C Offline
                                C Offline
                                CatchExAs
                                wrote on last edited by
                                #15

                                Say, main() by default was required to call a bunch of test suites that executed unit tests. I once worked somewhere where they did this btw.

                                D 1 Reply Last reply
                                0
                                • C CatchExAs

                                  Say, main() by default was required to call a bunch of test suites that executed unit tests. I once worked somewhere where they did this btw.

                                  D Offline
                                  D Offline
                                  Dave Kreskowiak
                                  wrote on last edited by
                                  #16

                                  Soooo, you're going to ship your unit tests with the code to the customer? That sounds stupid. That's like shipping the Paint Shop from the assembly plant with the car that it built.

                                  A guide to posting questions on CodeProject

                                  Click this: Asking questions is a skill. Seriously, do it.
                                  Dave Kreskowiak

                                  P C 2 Replies Last reply
                                  0
                                  • D Dave Kreskowiak

                                    By wrapping everything in an executable you're just adding extra dead weight.

                                    A guide to posting questions on CodeProject

                                    Click this: Asking questions is a skill. Seriously, do it.
                                    Dave Kreskowiak

                                    C Offline
                                    C Offline
                                    CatchExAs
                                    wrote on last edited by
                                    #17

                                    Do you know how much and if so is it a constant amount?

                                    D 1 Reply Last reply
                                    0
                                    • D Dave Kreskowiak

                                      Soooo, you're going to ship your unit tests with the code to the customer? That sounds stupid. That's like shipping the Paint Shop from the assembly plant with the car that it built.

                                      A guide to posting questions on CodeProject

                                      Click this: Asking questions is a skill. Seriously, do it.
                                      Dave Kreskowiak

                                      P Offline
                                      P Offline
                                      PIEBALDconsult
                                      wrote on last edited by
                                      #18

                                      Sounds more like including the diagnostic reader device with the car rather than requiring a visit to the shop when the check engine light comes on.

                                      D 1 Reply Last reply
                                      0
                                      • D Dave Kreskowiak

                                        Soooo, you're going to ship your unit tests with the code to the customer? That sounds stupid. That's like shipping the Paint Shop from the assembly plant with the car that it built.

                                        A guide to posting questions on CodeProject

                                        Click this: Asking questions is a skill. Seriously, do it.
                                        Dave Kreskowiak

                                        C Offline
                                        C Offline
                                        CatchExAs
                                        wrote on last edited by
                                        #19

                                        Or a compiler that bootstraps and tests itself? Or an installable that operations can't fuck up? There are always reasons for questions ;-)

                                        D 1 Reply Last reply
                                        0
                                        • C CatchExAs

                                          Do you know how much and if so is it a constant amount?

                                          D Offline
                                          D Offline
                                          Dave Kreskowiak
                                          wrote on last edited by
                                          #20

                                          It's not constant as the sizes of various tables in the resulting .EXE change depending on what is in the .EXE.

                                          A guide to posting questions on CodeProject

                                          Click this: Asking questions is a skill. Seriously, do it.
                                          Dave Kreskowiak

                                          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