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. Other Discussions
  3. The Weird and The Wonderful
  4. You will be on board if you answer this...

You will be on board if you answer this...

Scheduled Pinned Locked Moved The Weird and The Wonderful
questioncareer
30 Posts 21 Posters 5 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.
  • V VallarasuS

    In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

    Coz, it does not have a main method - He said!

    B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #7

    Yes, not having a main method is a key part of the correct answer to that.

    V 1 Reply Last reply
    0
    • V VallarasuS

      In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

      Coz, it does not have a main method - He said!

      S Offline
      S Offline
      SortaCore
      wrote on last edited by
      #8

      They probably saw rundll32.exe and made assumptions...

      1 Reply Last reply
      0
      • B Brady Kelly

        Yes, not having a main method is a key part of the correct answer to that.

        V Offline
        V Offline
        VallarasuS
        wrote on last edited by
        #9

        You may be right, but on the other hand I can compile any code into a dll, so does a "main()" method, but still it won't execute! ;P

        Regards Vallarasu S | BreakingDotNet.blogspot.com

        F R 2 Replies Last reply
        0
        • V VallarasuS

          In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

          Coz, it does not have a main method - He said!

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #10

          DLL not having the main method is not the right answer. In Windows, EXEs and DLLs have the same format which is the PE (Portable Executable) format. The PE format has a header called the optional header which records the address of the entry point. Both EXEs and DLLs can have an entry point. In fact DLLs do have a default entry point called DllMain. The only difference here is that, this entry point is optional for DLLs unlike that for an EXE. As for a DLL having multiple entry points, an EXE can also do this the same way a DLL does, by exporting them. And an external program can call into these exported entry points the same way it does for a DLL, using LoadLibrary and GetProcAddress. So the real difference is in a bit in one of the PE headers which states whether the image is a DLL or not, which the loader checks before executing the image.

          «_Superman_»  _I love work. It gives me something to do between weekends.

          _Microsoft MVP (Visual C++) (October 2009 - September 2013)

          Polymorphism in C

          1 Reply Last reply
          0
          • V VallarasuS

            In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

            Coz, it does not have a main method - He said!

            G Offline
            G Offline
            Gennady Oster
            wrote on last edited by
            #11

            The main difference is that exe runs in it's own address space as the independent process. The DLL works in the address space of the parent process, so the prolog executed during loading is different, and any entry point of the DLL cannot be called directly by OS. Only parent process can load and call DLL. That's why you need regsvr32 hosting exe to use DllRegisterServer "independent" entry point. Regards, Gennady

            My English is permanently under construction. Be patient !!

            1 Reply Last reply
            0
            • B BobJanova

              Oh, I don't read signatures as part of the post.

              Z Offline
              Z Offline
              Zabuzamomochi
              wrote on last edited by
              #12

              No one does ;)

              G 1 Reply Last reply
              0
              • V VallarasuS

                In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                Coz, it does not have a main method - He said!

                M Offline
                M Offline
                Magnamus
                wrote on last edited by
                #13

                An EXE is an out-of-process executable. A DLL is an in-process executable.

                1 Reply Last reply
                0
                • V VallarasuS

                  In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                  Coz, it does not have a main method - He said!

                  F Offline
                  F Offline
                  Florin Jurcovici
                  wrote on last edited by
                  #14

                  Actually, you _can_ run a dll - http://support.microsoft.com/kb/164787. Agree, it's not exactly the same as running an .exe, but then again, Windows itself starts tons of processes using rundll/rundll32.

                  1 Reply Last reply
                  0
                  • V VallarasuS

                    In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                    Coz, it does not have a main method - He said!

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

                    I would set aside all the BS responses they might be looking for and tell them the basic reason. An EXE is configured by the compiler as an application and a DLL is built to be an extension library that can be shared by multiple EXE files. Nothing more technical than that is needed. If they were looking for anything more than that at a basic level then I wouldn't want to work for them because they really like to pick nits about crap that isn't really all that relevant. -CB

                    S 1 Reply Last reply
                    0
                    • Z Zabuzamomochi

                      No one does ;)

                      G Offline
                      G Offline
                      Gary Huck
                      wrote on last edited by
                      #16

                      I just did :)

                      1 Reply Last reply
                      0
                      • C ClockMeister

                        I would set aside all the BS responses they might be looking for and tell them the basic reason. An EXE is configured by the compiler as an application and a DLL is built to be an extension library that can be shared by multiple EXE files. Nothing more technical than that is needed. If they were looking for anything more than that at a basic level then I wouldn't want to work for them because they really like to pick nits about crap that isn't really all that relevant. -CB

                        S Offline
                        S Offline
                        Steve Naidamast
                        wrote on last edited by
                        #17

                        I completely agree... I have found in the many interviews that I have taken that when the interviewers begin asking incredibly detailed questions relating to irrelevant knowledge for most application development they have no real interest in hiring anyone. Of course, they may also just like asking people a lot of stupid questions... :-)

                        Steve Naidamast Black Falcon Software, Inc. blackfalconsoftware@ix.netcom.com

                        C 1 Reply Last reply
                        0
                        • S Steve Naidamast

                          I completely agree... I have found in the many interviews that I have taken that when the interviewers begin asking incredibly detailed questions relating to irrelevant knowledge for most application development they have no real interest in hiring anyone. Of course, they may also just like asking people a lot of stupid questions... :-)

                          Steve Naidamast Black Falcon Software, Inc. blackfalconsoftware@ix.netcom.com

                          C Offline
                          C Offline
                          ClockMeister
                          wrote on last edited by
                          #18

                          Steve Naidamast wrote:

                          I have found in the many interviews that I have taken that when the interviewers begin asking incredibly detailed questions relating to irrelevant knowledge for most application development they have no real interest in hiring anyone. Of course, they may also just like asking people a lot of stupid questions...

                          When they get like that I begin to realize that they're just playing "Jeopardy". Any "propeller-head" can spout out technology terms. What I want to demonstrate to a prospective employer/client is that I know how to THINK. Sure, some built-in knowledge is important but EQUALLY important is realizing you can't keep it all in your head. That's what reference material is for. Why bother memorizing everything? If I'm aware of how a particular language feature works that's enough: when I need it I'll look it up if it isn't something I use on a day-by-day basis. I remember for a while some of the guys at our company were all about getting "certifications". Cool, except when I would go to them with a real problem they couldn't think clearly enough to solve the problem: it wasn't one of the test questions so they didn't know what to do! Heh ... -cb

                          1 Reply Last reply
                          0
                          • V VallarasuS

                            You may be right, but on the other hand I can compile any code into a dll, so does a "main()" method, but still it won't execute! ;P

                            Regards Vallarasu S | BreakingDotNet.blogspot.com

                            F Offline
                            F Offline
                            Fabio Franco
                            wrote on last edited by
                            #19

                            Exactly, the correct term would be a main entry point. The main method is just a label used by compilers to indicate the main entry point of the application. Plus, there are a few details that are different between DLLs and EXEs like the PE Header.

                            To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson ---- Our heads are round so our thoughts can change direction - Francis Picabia

                            1 Reply Last reply
                            0
                            • V VallarasuS

                              You may be right, but on the other hand I can compile any code into a dll, so does a "main()" method, but still it won't execute! ;P

                              Regards Vallarasu S | BreakingDotNet.blogspot.com

                              R Offline
                              R Offline
                              RafagaX
                              wrote on last edited by
                              #20

                              Yes it will, if you know the magic words (or command).

                              CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                              1 Reply Last reply
                              0
                              • V VallarasuS

                                In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                                Coz, it does not have a main method - He said!

                                R Offline
                                R Offline
                                RafagaX
                                wrote on last edited by
                                #21

                                If i asked this question i would expect this answer: "Both CAN be run, usually a DLL is intended to be used inside another program, that's why normally you don't run a dll directly." But an acceptable answer will be: "DLLs are intended to be used inside programs, while EXEs are programs themselves"

                                CEO at: - Rafaga Systems - Para Facturas - Modern Components for the moment...

                                1 Reply Last reply
                                0
                                • K Keith Barrow

                                  VallarasuS wrote:

                                  Wait! What would you answer if such question was fired at you?

                                  Probably the answer they were looking for: An exe requires a fixed entry point, so the loader can work out where start execution. A dll lacks this entry point and therefore the loader can't work out where to start. Other than that, I don't think there are any important differences between an exe and dll, though I could be wrong about that.

                                  Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                                  -Or-
                                  A Dead ringer for Kate Winslett[^]

                                  P Offline
                                  P Offline
                                  patbob
                                  wrote on last edited by
                                  #22

                                  DllMain() [edit] Oh, and check out the /ENTRY option on the linker too.

                                  We can program with only 1's, but if all you've got are zeros, you've got nothing.

                                  1 Reply Last reply
                                  0
                                  • V VallarasuS

                                    In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                                    Coz, it does not have a main method - He said!

                                    U Offline
                                    U Offline
                                    User 3150502
                                    wrote on last edited by
                                    #23

                                    Also, a DLL doesn't have its own stack, by default. An exe does.

                                    1 Reply Last reply
                                    0
                                    • V VallarasuS

                                      In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                                      Coz, it does not have a main method - He said!

                                      N Offline
                                      N Offline
                                      Naoya Yamaguchi
                                      wrote on last edited by
                                      #24

                                      On Windows, there are cases where you can run a function in a dll with rundll32.exe if the function's takes no args and its return type is void. In other words, the function needs to be as much of a standalone as an exe file. For example, in Powersell, PS> rundll32.exe advapi32.dll,ProcessIdleTasks PS> rundll32.exe user32.dll,LockWorkStation

                                      C 1 Reply Last reply
                                      0
                                      • V VallarasuS

                                        In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                                        Coz, it does not have a main method - He said!

                                        K Offline
                                        K Offline
                                        KP Lee
                                        wrote on last edited by
                                        #25

                                        I confess I didn't read the tag line either. There's a bit of a problem with the semantics of the statement too. I'd agree that you can't start an execution from a dll (from other comments, I'd be wrong about that too, but don't know how), but you definitely do run dll code.

                                        1 Reply Last reply
                                        0
                                        • V VallarasuS

                                          In an interview an year ago I was asked with this question. When you can 'Run' an exe file, why can't a 'dll'? :confused::confused::confused: I was speechless and said 'it was not intended to be' but to no avail. It was clear the interview panel wasn't prepared for interviewing and I managed to to get the interviewers answer! Wait! What would you answer if such question was fired at you?

                                          Coz, it does not have a main method - He said!

                                          C Offline
                                          C Offline
                                          Chad3F
                                          wrote on last edited by
                                          #26

                                          Well.. technically, if it is the right kind of DLL, you can.. using rundll32.exe (which has been included in at least the last few versions of windows). It lets you execute any entry-point style (think WinMain signature) named code symbol. I guess it was easier for M$ to write a few DLL's with many functions, rather than dozens (or hundreds/thousands) of individual linked EXE's, each for a specific purpose.

                                          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