The SFTDATE_STATIC preprocessor symbol selects static linking of SftDate/DLL to an application.
#define SFTDATE_STATIC
The SFTDATE_STATIC preprocessor symbol selects static linking of SftDate/DLL to an application. An application that links statically includes the code of the controls in its executable and does not need the SftDate/DLL DLL files at run-time.
The symbol must be defined before the header file SftDate.h is included, preferably using the project's preprocessor definitions, so all source files use the same setting.
SftDate.h automatically adds the required Lib file to the application (Microsoft Visual C++). SFTDATE_STATIC determines which Lib file is used:
| Platform | Character Set | SFTDATE_STATIC defined | SFTDATE_STATIC not defined |
|---|---|---|---|
| x64 | Unicode | SftDate_x64_U_20_Static.lib | SftDate_x64_U_20.lib |
| x64 | ANSI | SftDate_x64_A_20_Static.lib | SftDate_x64_A_20.lib |
| Win32 (x86) | Unicode | SftDate_IX86_U_20_Static.lib | SftDate_IX86_U_20.lib |
| Win32 (x86) | ANSI | SftDate_IX86_A_20_Static.lib | SftDate_IX86_A_20.lib |
| ARM64 | Unicode | Not available | SftDate_ARM64_U_20.lib |
| ARM64 | ANSI | Not available | SftDate_ARM64_A_20.lib |
With SFTDATE_STATIC, SftDate.h also adds the system libraries the static library needs (uxtheme.lib, imm32.lib, gdiplus.lib). There is no static library for ARM64.
The Unicode Lib files are used if UNICODE or _UNICODE is defined, otherwise the ANSI Lib files are used. An application that prefers to add the Lib file to its linker settings can define the SFTDATE_NOAUTOLIB preprocessor symbol before including SftDate.h, which suppresses the automatic selection.
As for an application using the DLL, RegisterApp must be called before a control is created and UnregisterApp when the application no longer uses the controls. In a statically linked application, RegisterApp registers the window classes (SFTDATE_CLASS, SFTCALENDAR_CLASS) for the application instance passed to it.
A statically linked application must also include the resources of the controls in its resource script, using the resource include file SftDateResources.rci (see Building Applications).
See Also C/C++ API | Categories | Notifications