convert .exe to dll

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • momukhtar
    New Member
    • Jul 2007
    • 5

    convert .exe to dll

    Hi all

    My task is to convert .exe (Windows Application like MS Paint) into a dll. The application is build using MFC and it includes lot of files afx....h and implements message map functions. There are a lots of classes derived from classes in afx....h.
    Any steps and guidance as how should I proceed is highly appreciated.
    I am using Visual Studio .NET 2005 and VC++8.0.
    I completely do not need the windows functionality just the functions inside that project.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by momukhtar
    Hi all

    My task is to convert .exe (Windows Application like MS Paint) into a dll. The application is build using MFC and it includes lot of files afx....h and implements message map functions. There are a lots of classes derived from classes in afx....h.
    Any steps and guidance as how should I proceed is highly appreciated.
    I am using Visual Studio .NET 2005 and VC++8.0.
    I completely do not need the windows functionality just the functions inside that project.

    The frst thing you need for a dll in windows is the .def file
    This file says which functions are exposed from the dll.
    You have to start from here.

    Raghuram

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      You will need to create a Win32 project to builf your DLL.

      When you do this, a wizard will appear.

      Do not click finish.

      Instead, click application settings and then select DLL and empty project.

      Now click finish.

      Next, add you .cpp files to this project. When you build, you will have your DLL.

      Pay attention to the previous post about the .DEF file. A DLL is a C relic and in C you ask for functions by name. C++ has function overloading which means the function names are "mangled" into a unique name used internally by C++. These "mangled" names will be in your DLL making it impossible for you to ask for the function by the C name. The .DEF file allows you to export the "mangled" name as a C function name.

      Be sure to get a copy of Windows via C/C++ by Jeffrey Richter 2008. Starting on page 537 are about 180 pages about DLLs in Windows.

      Good luck.

      Comment

      Working...