Description
A C++ DLL (Dynamic Link Library) is a shared library containing functions and data, that one or more applications can load as needed. Sometimes it's desirable to make only some of the functions and data items available to library users, while at other times you will want to export all functions.
There are three ways of exporting symbols for external use. One is to use the link(exportall) directive. This is the subject of a separate example.
Another approach is to use the _Export keyword, for example by saying:
int _Export f() {...}
int _Export x;
class _Export A {...};
A final approach is to use #pragma export(), by saying:
int f(int) {...}
#pragma export(f(int))
Concept
The sample is divided into two parts, each with a configuration file. A set of C++ classes is defined in a header file, and the classes are implemented in a regular source file. This file is compiled into a DLL, and used by an application program that exercises all the class functions.
There are a couple of interesting points to note about the example. The first is that there are a variety of possible types of exportable C++ entities, including constructors, whole classes, static functions, operators, conversion functions, and overloaded functions. The example demonstrates how to export each of these, using either _Export or #pragma export().
The example also shows some cases of unexported functions and data, items that are not available to a user of the DLL.
Supported
Supported
Supported
