[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


converting .exe to .dll

Posted on 2004-10-28
Medium Priority
Last Modified: 2010-04-24
hello there
I have question. I have a running .exe program. i want to convert this .exe into a .dll file which I can use in a different application.
can any one walk me through this particular problem. Its really urgent for me to get this done asap. so plz reply at the earliest
Thanks in advance. Bye
Question by:vikrantp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Svetlin_Panayotov earned 252 total points
ID: 12441517
LVL 19

Assisted Solution

drichards earned 248 total points
ID: 12446799
You could do it by removing 'main' from your app and changing a lot of project settings so it will compile properly.  It's not really that hard but it's easy to miss something.

An easier solution is to create an empty dll project, move the source files from the executable into the dll project directory (or move the dll project files into the directory where the executable source code is if you don't need the executable project any more) and then add all the source files to the dll project.  You will still need to remove the 'main' function in either case.

To use functionality from the dll, however, you will need to export classes, functions, and data you want to use in other projects.  To make sure things are exported and later imported correctly, you should define a preprocessor macro and use it to define dllexport or dllimport like this:

#ifdef IN_MY_DLL
   #define MY_DLL_IMPORT __declspec(dllexport)
   #define MY_DLL_IMPORT __declspec(dllimport)

then use 'MY_DLL_IMPORT' on things you want to be exported from your dll.  Make sure these are included in headers that will be used by importing projects later.  Your dll should define 'IN_MY_DLL' (name it as you like and change the sample) in the dll project but NOT in importingprojects.  This will correctly export/import things.

Read the docs on dllexport/dllimport to see where to put 'MY_DLL_IMPORT' (use in place of __declspec(dll??port)):

Once done, you can recreate the original executable by leaving the 'main' function in the original project and linking with the new dll you created.  This would require moving the rest of the source into the new dll project directory.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question