Search code examples
c++dllc++builder-6

How to create dll from app source in c++ builder 6?


I have legacy code in C++Builder 6. I try to create a DLL from source code, but only one thing which I have on output is an EXE. I tried to change the application target extension and entry point, but nothing helps.

I think about compiling from console, but there is some errors in the project, that I can't see when compiling in the IDE. I have linker errors, which I can't fix.

At least all code are "extern C" and I need lib and dll.

How can I compile a DLL from the app source?


Solution

  • A DLL needs certain pre-defined functions and the project Wizard creates them for you automatically, so

    • Start a new fresh project as a DLL/library project.

    • Create a simple function that you can test.

    • Compile the DLL and load it (and call the test function) from an .exe in another project to check that it's working.

    • Copy the essential parts of your old code, bit by bit, from the old .exe project into the correct places in the new DLL/library project.

    Done.