| Startseite Produkte News Bestellungen Download Support Kontakt |
|
To create a simple DLL to be called from HTBasic using Microsoft DevStudio 6.0:
At this point a new project has been created with no source files in it. A C++ source file to hold our code now needs to be created.
A source file to place the C++ functions and subprograms in now exists. Type the C++ source code into the file just created.
A DLL like any C++ project can consist of multiple source files that are compiled separately and then linked together. For simplicity this example uses only one source file. A file which designates which labels will be visible outside of the DLL now needs to be created.
This file will list the labels that will be visible outside the DLL. In the .def file just created type the word EXPORTS (all capital letters), and then on the next lines list the labels from the project that other programs, such as your HTBasic programs must be able to see.
Remember that C and C++ are case sensitive. The labels must be listed in the .def file exactly the same as they are declared. Save this file and build the project by selecting the Build menu item Build <DLLname> or Rebuild All. A hot-key shortcut to build a project is F7. There is also an icon on the toolbar to build the project. If the output window says “0 error(s), 0 warning(s)” then the DLL has been successfully created and is ready to be used by other programs such as HTBasic.
It is a good idea to write some documentation for your DLL. It should include a list of all the exported labels, what they are, and how to use them. This documentation is vital for a user that may be using your DLL. It will also be useful if you ever have to remember what is in your DLL and the original source code is not available or too inconvenient to check.
The nicer and more detailed you make your documentation, the happier your users will be. |
|
Problem Report | Tutorials | DLL Toolkit | Downloads | Faq |