Support for a custom module can be linked statically into an application if desired. For example, this can be done for the CustomObjectsModule example by including the following macros in the program that you want to use the extension module:
#ifndef _TOOLKIT_IN_DLL_
// Declare the entry point function for the custom module (one for each module).
ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(CustomObjectsModule);
ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(ModelerModule);
ODRX_BEGIN_STATIC_MODULE_MAP()
ODRX_DEFINE_STATIC_APPLICATION("ExCustObjs", CustomObjectsModule)
ODRX_DEFINE_STATIC_APPLICATION("ModelerGeometry", ModelerModule)
ODRX_END_STATIC_MODULE_MAP()
#endif
After the static module map has been declared, the host application should call the ODRX_INIT_STATIC_MODULE_MAP macro once to initialize the static module map. This should be done after odInitialize.
After the static module map has been declared, the host application should call the ODRX_INIT_STATIC_MODULE_MAP macro once to initialize the static module map. This should be done before odInitialize().
#ifndef _TOOLKIT_IN_DLL_ODRX_INIT_STATIC_MODULE_MAP();
#endif
// Create a Services object
OdStaticRxObject<MyServices> svcs;
// Initialize Runtime Extension environment
odrxInitialize(&svcs);
After these calls have been made, the registered custom module is loaded on demand (for example, when this module is needed to serialize a custom object), or it can be loaded explicitly by calling OdRxDynamicLinker::loadModule and passing the application name that was registered in the first argument to ODRX_DEFINE_STATIC_APPLICATION.
You might notice that there is a class OdDgnModule : public OdRxModule and OdDgn7IOModule : public OdRxModule. The OdDgnModule::initApp() method involves the registration of all of the interfaces, such as OdDgDatabase::rxInit() and OdDgLine2d::rxInit(). This module introduces, registers, and unregisters all of the standard Drawings SDK .dgn-file objects.
Creating an Custom Application
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|