Differences between dll and exe in .net




















So, a DLL is run inside another memory space. The other memory space can be a console, or windows applications, or web applications that should have their own memory space. For example, you can invoke the DLL from a console application.

In order to use the MyClassLibrary. Now, run the application and you should see the following output. Now, the question that should come to your mind why do we need DLLs as it is not invoked by itself. The reason behind the DLL is reusability. Suppose you want some class, or logic, or something else in many applications, then simply put those classes, logic inside a DLL, and refer that DLL wherever it is required. In the next article, I am going to discuss App Domain in.

NET Framework in detail. NET Framework in detail with Examples. I hope you enjoy this article and got a better idea of these three concepts. Nicely explaining the concepts. Is there any post related on algorithms. Your email address will not be published. Skip to content. Previous Lesson Garbage Collector in. Asked 12 years, 5 months ago. Active 1 year, 3 months ago. Viewed k times. I want to know the exact difference between the dll and exe file. Improve this question. Umesh Aawte Umesh Aawte 4, 6 6 gold badges 40 40 silver badges 51 51 bronze badges.

You should add some context here: Are you a beginner Are you looking a some kind of deep technical specification of the PE stuff Or something else — khebbie. It is true I am a beginner. It is a interview-question as tagged. More importantly, this is a duplicate including one deleted by sakthivignesh Add a comment.

Active Oldest Votes. Well, the major differences are: EXE An exe always runs in its own address space i. The purpose of an EXE is to launch a separate application of its own. DLL A dll always needs a host exe to run.

DLL is Microsoft's implementation of a shared library. Improve this answer. Aamir Aamir So, if you wanted you coudl rename and edit the header of the fikle to turn a dll into an exe and vice versa? RCIX: I doubt that is possible? It's most likely not possible - see kichik's answer below. EXE: It's a executable file When loading an executable, no export is called, but only the module entry point.

When a system launches new executable, a new process is created The entry thread is called in context of main thread of that process. The system loads a DLL into the context of an existing process. Daniel Goldberg Since you can use LoadLibraryEx on an exe or dll that means you can use the GetProcAddress to load an entry point from an exe or a dll. So in that regard both exe and dll files can be dynamically linked and can have any number of entry points. The difference is that an EXE has an entry point, a "main" method that will run on execution.

The code within a DLL needs to be called from another application. Robin Day Robin Day This is misloading, it implies that DLLs don't have entry points. There are a few more differences regarding the structure you could mention. PE files consist of some headers and a number of sections.

There's usually a section for code, a section for data, a section listing imported functions and a section for resources.

Some sections may contain more than one thing. The header also describes a list of data directories that are located in the sections. Those data directories are what enables Windows to find what it needs in the PE. But one type of data directory that an EXE will never have unless you're building a frankenstein EXE is the export directory. It specifies the virtual address at which the PE assumes it will be loaded. If it is loaded at another address, some pointers could point to the wrong memory.

As EXE files are amongst the first to be loaded into their new address space, the Windows loader can assure a constant load address and that's usually 0x That luxury doesn't exist for a DLL. Two DLL files loaded into the same process can request the same address. This is why a DLL has another data directory called Base Relocation Directory that usually resides in its own section -. Most EXE files don't have this directory, but some old compilers do generate them. As those are flags, both can be set at once.

As you said, it's possible but vanishingly unlikely. ASLR will relocate the exe too, if it can. So yes, even an exe can have relocations. Jun, Sep, Jul, Nov, Dec, Jun, 6. Feb, 4. Nov, 9. Developer Programmer Sr. Developer Sr. Why do you want to leave your current company? What is ASP.

NET Core? How to iterate through ArrayList in jQuery? What is the difference between TempData keep and peek function? A class provides a default constructor for me.



0コメント

  • 1000 / 1000