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.
  • 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
          • C CatchExAs

            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 Offline
            L Offline
            Lost User
            wrote on last edited by
            #21

            You can have a static int Test(string[] args) for that (unless you plan on using debug, vs stdout). Call it with the help of a shell-extension or external command that loads the assembly and executes your custom entrypoint :rolleyes:

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

            P 1 Reply 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

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

              A single static method. How much do they weigh? ..and now in metric? :-\

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

              D 1 Reply Last reply
              0
              • P PIEBALDconsult

                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 Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #23

                When was the last time you executed unit tests on customer site? I've written seperate tools to diagnose database problems, but never to verify "the code". If the .EXE gets corrupted, chances are good it won't even run, and if it is corrupted, chances are good you've got hardware problems.

                A guide to posting questions on CodeProject

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

                P 1 Reply Last reply
                0
                • C CatchExAs

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

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

                  CatchExAs wrote:

                  Or a compiler that bootstraps and tests itself?

                  Really? How often do you see that and how often are you going to use it?

                  CatchExAs wrote:

                  Or an installable that operations can't f*** up?

                  Depending on what you mean by "operations", yeah, right. If you're talking about people, there's nothing they can't fuck up and there's always some situation that you're code isn't going to be able to recover from.

                  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
                  • D Dave Kreskowiak

                    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 Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #25

                    +5 "Let's make a shared library out of that code" "Lets us ILMerge those" :omg: It is also done on the web, where they call it "packaging" or something like it. I wonder how many sites made me download a JQuery library that's already cached in the browser.

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

                    P 1 Reply Last reply
                    0
                    • L Lost User

                      A single static method. How much do they weigh? ..and now in metric? :-\

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

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

                      It's the startup code, import tables, data tables, blah, blah, blah for a Win32 executable, that a .DLL doesn't have, nor need. A .NET assembly in an .EXE is not 100% MSIL code. There is still unmanaged code in there to get the process running under the CLR.

                      A guide to posting questions on CodeProject

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

                      P 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        When was the last time you executed unit tests on customer site? I've written seperate tools to diagnose database problems, but never to verify "the code". If the .EXE gets corrupted, chances are good it won't even run, and if it is corrupted, chances are good you've got hardware problems.

                        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
                        #27

                        I never write or execute unit tests at all, anywhere. I don't have the same concerns as the OP and I don't think we're talking about DLLs shipped with an application, but libraries provided to other developers for use in their applications -- like if I wrote an ISO 8601-compliant date handling library for example, but only distributed the DLL rather than the code. Personally, when I get a DLL from some third-party (an ADO.net provider perhaps) I don't like having to create a Solution and Project, then add a reference just so I can use the Object Explorer to see what's in it. It would be convenient if it were an EXE and running it would provide (version-specific) documentation and such (hopefully more accurate than what's available on the developer's website, if any). Additionally, the Object Explorer only says what's in there, not how to use it, no documentation. I suspect there must already be a tool that allows sort of a command-line Object Explorer, but I haven't looked. Certainly one could be written, but it still wouldn't provide everything that a custom baked-in tool would. Seeing that given a DLL with some (public) class C with a (public) method M that takes a string parameter S and returns a string is all well and good, but wouldn't it be convenient to immediately be able to execute: somelib test C.M "hello world" and have it report the result? Without having to access an IDE and write a simple test app just to see what it does?

                        1 Reply Last reply
                        0
                        • L Lost User

                          You can have a static int Test(string[] args) for that (unless you plan on using debug, vs stdout). Call it with the help of a shell-extension or external command that loads the assembly and executes your custom entrypoint :rolleyes:

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

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

                          Having a separate console app that loads the Assembly would definitely be another way, but the only reason would be to simply remove the main, I don't see a big benefit.

                          C L 2 Replies Last reply
                          0
                          • L Lost User

                            +5 "Let's make a shared library out of that code" "Lets us ILMerge those" :omg: It is also done on the web, where they call it "packaging" or something like it. I wonder how many sites made me download a JQuery library that's already cached in the browser.

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

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

                            Oh, you've done SSIS too? :sigh:

                            1 Reply Last reply
                            0
                            • D Dave Kreskowiak

                              It's the startup code, import tables, data tables, blah, blah, blah for a Win32 executable, that a .DLL doesn't have, nor need. A .NET assembly in an .EXE is not 100% MSIL code. There is still unmanaged code in there to get the process running under the CLR.

                              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
                              #30

                              Dave Kreskowiak wrote:

                              There is still unmanaged code in there to get the process running under the CLR

                              I'd be (at least a little) surprised if that got loaded with the Assembly when referenced in the usual way -- it ought to only affect disk usage except when executed (but then we're talking about Microsoft).

                              C 1 Reply Last reply
                              0
                              • D Dave Kreskowiak

                                CatchExAs wrote:

                                Or a compiler that bootstraps and tests itself?

                                Really? How often do you see that and how often are you going to use it?

                                CatchExAs wrote:

                                Or an installable that operations can't f*** up?

                                Depending on what you mean by "operations", yeah, right. If you're talking about people, there's nothing they can't fuck up and there's always some situation that you're code isn't going to be able to recover from.

                                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
                                #31

                                Dave Kreskowiak wrote:

                                Really? How often do you see that and how often are you going to use it?

                                True, you see it rarely. But it is a useful technique to some, and so might be useful to others. You wouldn't know until you tried it.

                                Dave Kreskowiak wrote:

                                Depending on what you mean by "operations", yeah, right. If you're talking about people, there's nothing they can't f*** up and there's always some situation that you're code isn't going to be able to recover from.

                                Of course, which is why we automate things in the first place but the point is that the deployed binary can run tests on itself 'in situ' rather than a test environment which may or may not be representative of the target production environment.

                                1 Reply Last reply
                                0
                                • P PIEBALDconsult

                                  Having a separate console app that loads the Assembly would definitely be another way, but the only reason would be to simply remove the main, I don't see a big benefit.

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

                                  I was thinking: myProgram.exe -> runs a test suite myProgram.exe /run -> runs a traditional program if implemented or returns if it's a library

                                  P 1 Reply Last reply
                                  0
                                  • P PIEBALDconsult

                                    Dave Kreskowiak wrote:

                                    There is still unmanaged code in there to get the process running under the CLR

                                    I'd be (at least a little) surprised if that got loaded with the Assembly when referenced in the usual way -- it ought to only affect disk usage except when executed (but then we're talking about Microsoft).

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

                                    I just made a rough measure of this empirically: 1 class and 1 method DLL in release mode (4k on disk) vs EXE (5k on disk) 10 classes with 10 methods each in release mode gave DLL (7k on disk) and EXE (8k on disk) So the bloat increases far less than I'd consider to be significant. As for process start and CLR load.... remember we are just loading a library into an existing running CLR.

                                    P D 2 Replies Last reply
                                    0
                                    • C CatchExAs

                                      I was thinking: myProgram.exe -> runs a test suite myProgram.exe /run -> runs a traditional program if implemented or returns if it's a library

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

                                      That sounds kinda backward to me.

                                      1 Reply Last reply
                                      0
                                      • C CatchExAs

                                        I just made a rough measure of this empirically: 1 class and 1 method DLL in release mode (4k on disk) vs EXE (5k on disk) 10 classes with 10 methods each in release mode gave DLL (7k on disk) and EXE (8k on disk) So the bloat increases far less than I'd consider to be significant. As for process start and CLR load.... remember we are just loading a library into an existing running CLR.

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

                                        I think Dave is also concerned about size in memory (when referenced normally), which is harder to measure.

                                        1 Reply Last reply
                                        0
                                        • C CatchExAs

                                          I just made a rough measure of this empirically: 1 class and 1 method DLL in release mode (4k on disk) vs EXE (5k on disk) 10 classes with 10 methods each in release mode gave DLL (7k on disk) and EXE (8k on disk) So the bloat increases far less than I'd consider to be significant. As for process start and CLR load.... remember we are just loading a library into an existing running CLR.

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

                                          Yeah, you're looking at disk usage, not in memory. If you want an idea of what overhead you're including, look at the Imports table in the .EXE.

                                          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
                                          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