I wrote the basicdll example code with Boralnd C++, so this tutorial will be an easy write :)


Borland C++ 5.0 | Compiling the basicdll example code

1. Setting up -

First, unzip the basicdll example sourcecode into a directory on your hard disk (like quake2\mods\basicdll), and fire up Borland C++.

2. Making a new Project -

From the File menu, choose Project | New, and the "New Project" dialog box will pop up.  We need to tell BC++ where to keep our project file, so choose the Browse button and browse to the directory where you unzipped the basicdll example code. Now type in "DLL Example" for the name of the project, and press Ok.

Under the Target Type groupbox, select Dynamic Library (instead of Application). Under the Frameworks groupbox, uncheck the Owl and Class Library boxes, since we won't be using either of those in this project.

Now press Ok.

3. Modifying the Project -

From the Options menu, choose Environment.  In the ensuing dialog box, click on the Project View node and check the Show Project Node box.  Now click Ok.

Now rightclick the DLL Example.dll node and select Edit Node Attributes.  Change the name of the node to "basicdll.dll" and press Ok.

Notice all those child nodes of basicdll.dll?   Delete them - we don't need them.  Next, rightclick on the basicdll.dll node and select Add Node.  Select basicdll.c and basicdll.def and click Ok.  Now we have added the two source files needed to compile basicdll.dll.

4. Adding a new target - DLLUser.exe -

Before going further, I'll explain what a target is - it is a specifc compiled EXE or DLL.  In BC++, a project can contain multiple targets.   Our project will contain two targets - basicdll.dll and dlluser.exe.  We are about to add the dlluser.exe target...

From the Project menu choose New Target.  In the dialog box, type in "DLLUser" and hit Ok.  The New Target dialog box now appears.

In this dialog box, under Target Type select Application instead of Dynamic Library.  Now hit Ok and we have a new target.

5. Modifying the DLLUser.exe target -

Again, go and delete all the child nodes of DLLUser.exe.   RightClick on the DLLUser.exe node and select Add Node.  Choose the dlluser.c, dlluser.def, and dlluser.rc files and click Ok.  Now the DLLUser.exe node contains the sourcecode to DLLUser.exe.

6. Running DLLUser.exe

Now our project is all set to go.   Choose Make Project from the Project menu and BC++ will compile all your code.   Everything should go smoothly.  Now select the DLLUser.exe node and select Run from the Debug menu (or click on the lightning bolt on the toolbar).  There you go!

Once everything is running smoothly, go through all the sourcecode and play with it.  Change values, watch what happens, etc... just have fun learning!