DynObj - C++ Cross platform plugin objects
Building and using the libraryDirectory layout of the library:
Build modelPlugin are usually opened while the application is running, so there is no build-time link between the main application and the plugins. When a plugin module is loaded, by default, the linker is instructed not to backlink into the application (Unix). On Windows, backlinking is not possible.
An application can expose functionality to plugins through interfaces. DoRunTimeI provides a way to make named instances of objects known globally.
Compiler definesA number of compiler defines controls how libraries and main applications are built. The defines are described in detail in src/DynObj/DoSetup.h (and under DynObj defines in doxygen doc).
When compiling a library DO_MODULE should be defined. Also, the name of the library should be stored in DO_LIB_NAME (i.e. #define DO_LIB_NAME "DynStr").
The main application should define DO_MAIN.
The default settings in DoSetup.h are OK when compiling the samples. In general the defines are used like this (example DO_USE_DYNSHARED):
Building the DynObj libraryThere are two build methods provided with the library:
Building a plugin (module)The compiler define DO_MODULE should be set.
A plugin module requires compiling with:
Building a main application (using plugins/modules)The compiler define DO_MAIN should be set.
The main application links against one of two static libraries:
To build the libraries using the makefile:
$ cd src/DynObj
The DynStr libraryA run-time plugin class for strings is provided: DynStr. This enables plugins to use a C++ string class in a safe way, internally and in function calls.
The DynStr library is built with:
$ cd src/DynObj
Building the samplesThe samples defines a PersonI and ProfessionI interfaces. Then three slightly different implementations are provided in three plugins: pimpl1, pimpl2, pimpl3
Three different main applications are provided as well: main1, main2, main3.
There are sub-projects for each of them in the VC++ solution file.
From the command prompt:
$ cd samples
The pdoh tool can generate these sections:
By default pdoh sends its output to stdout. Use option -o to overwrite the input file, or -oNewFile.h to write to another file. To generate less comments in the output -b can be used.
pdoh can be integrated into a build environment, it is a simple file scanner so it is fast. If it does not find any //%%DYNOBJ tags it will not generate any output.
If the tags have not been modified since the previous run (on the same file), it will also not generate any output (so it does not affect file time stamps when there is no need for it).