locked
Design question - exe vs dll RRS feed

  • Question

  • Hi all,

    I am confused about a design decision. I need to apply business rules which are already coded in .DLL. The DLL was being called from SSIS in iterative fashion for each row in database and was taking too long. so I planned to introducing a .net layer to process records in-memory and update all at once in database using a stored procedure and remove iteration in SSIS. I am confused if this layer should be a dll or .exe. So the new design should be SSIS calling .net dll or a .net exe which in turn calls the business layer .dll components. Multiple packages would need to call multiple instances of .net component(exe/dll). Can someone throw an opinion in terms of performance and instance management. Muliple packages from SSIS calling this new component may be seen as individual threads. Do i need to manage threading in new component (dll/exe). Any details would help.
    Regards

    vishal

    Tuesday, April 5, 2016 10:52 AM

Answers

  • First let’s be clear what the difference between and “.exe” and “.dll” are in .NET.

    EXE

    1. The purpose of an EXE is to launch a separate application of its own.
    2. An exe runs in its own address. It is a separate process.

    DLL

    1. A DLL always needs a host exe to run. It can’t run in its own address space.
    2. The purpose of a DLL is to have a collection of methods/classes which can be re-used from some other application.

    The file format of DLL and EXE are basically the same. Windows recognizes the difference between DLL and EXE through PE Header in the file.

    Also it seems you don't want the code to be synchronous. You can make the operation a not-awaited background task. If you are not familiar with the TPL (Task Parallel Library), please refer to the following post on how to start Tasks in .NET. 

    So yes you would manage the threading in the external component.

    http://dotnetcodr.com/2014/01/01/5-ways-to-start-a-task-in-net-c/



    Thursday, April 7, 2016 5:02 PM
  • Launching an exe means creating a process for it to run on and a memory space. A DLL isn't launched by itself and is called by another application. It doesn't have its own memory space & process. It shares the process & memory space of the application that is calling it.

    Hence the in-process / out-of-process. It may be confusing, so perhaps I'll revise my answer.

    My comment about re-use refers to a DLL having a collection of classes/methods which can be re-used from some other application.


    william xifaras




    Tuesday, April 12, 2016 4:38 PM

All replies

  • First let’s be clear what the difference between and “.exe” and “.dll” are in .NET.

    EXE

    1. The purpose of an EXE is to launch a separate application of its own.
    2. An exe runs in its own address. It is a separate process.

    DLL

    1. A DLL always needs a host exe to run. It can’t run in its own address space.
    2. The purpose of a DLL is to have a collection of methods/classes which can be re-used from some other application.

    The file format of DLL and EXE are basically the same. Windows recognizes the difference between DLL and EXE through PE Header in the file.

    Also it seems you don't want the code to be synchronous. You can make the operation a not-awaited background task. If you are not familiar with the TPL (Task Parallel Library), please refer to the following post on how to start Tasks in .NET. 

    So yes you would manage the threading in the external component.

    http://dotnetcodr.com/2014/01/01/5-ways-to-start-a-task-in-net-c/



    Thursday, April 7, 2016 5:02 PM
  • Well, not strictly true, an EXE can be used by another process.

    That's the first time I've heard terms in-process and out-process to describe EXE/DLLs, learn something new every day :)


    http://pauliom.wordpress.com

    Sunday, April 10, 2016 8:54 PM
  • Launching an exe means creating a process for it to run on and a memory space. A DLL isn't launched by itself and is called by another application. It doesn't have its own memory space & process. It shares the process & memory space of the application that is calling it.

    Hence the in-process / out-of-process. It may be confusing, so perhaps I'll revise my answer.

    My comment about re-use refers to a DLL having a collection of classes/methods which can be re-used from some other application.


    william xifaras




    Tuesday, April 12, 2016 4:38 PM