Drawings SDK Developer Guide > Working with .dwg Files > Working with Applications > Loading Additional Modules
Loading Additional Modules

In addition to the set of libraries required for developing any application, Drawings SDK contains optional libraries — modules — that are required for implementing specific features, such as: point cloud functionality, export/import to Collada files, rendering support, and others. For convenience, most modules are made in two versions: shared and static. According to your purposes you can use either shared or static sets for developing applications with the following instructions for loading specific types of modules. If your application uses shared ODA libraries, you should use shared optional modules. If you statically link ODA libraries, you have to use static optional modules.

Loading shared optional modules

If your application intends to use dynamic versions of a specific module (.tx, .txv), just put the proper module file in the application folder. The module will be loaded on demand (for example, when the module is needed to materialize a custom object being loaded from file) or it can be loaded explicitly by calling OdRxDynamicLinker::loadModule() with the module's name as a parameter. For example, to make the point cloud functionality available:


::odrxDynamicLinker()->loadModule(DbPointCloudObjModuleName);

Loading static libraries and optional modules

In the case of static configuration, you need to specify all of the required modules in a module map before loading them. This can be done by including special macros. For example:


#ifndef _TOOLKIT_IN_DLL_

// Declare the entry point function for the module (one for each module) 
// using a name of the class that implements support for this module.

ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(ModelerModule);
ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(OdRecomputeDimBlockModule);
ODRX_DECLARE_STATIC_MODULE_ENTRY_POINT(ExFieldEvaluatorModule);

// Define the module map using a modules' file names and classes.

ODRX_BEGIN_STATIC_MODULE_MAP()
  ODRX_DEFINE_STATIC_APPLICATION(OdModelerGeometryModuleName,   ModelerModule)
  ODRX_DEFINE_STATIC_APPLICATION(OdRecomputeDimBlockModuleName, OdRecomputeDimBlockModule)
  ODRX_DEFINE_STATIC_APPMODULE(OdExFieldEvaluatorModuleName, ExFieldEvaluatorModule)
ODRX_END_STATIC_MODULE_MAP()

#endif

After the module map has been declared, the application should use the ODRX_INIT_STATIC_MODULE_MAP macro once to initialize the static module map. This should be done before the odInitialize() function, for example:


#ifndef _TOOLKIT_IN_DLL_
    ODRX_INIT_STATIC_MODULE_MAP();
#endif
    odInitialize(this);

The information above is the only difference between using shared and static modules. Once these calls have been made, the registered custom module will be loaded on demand, or it can be loaded explicitly by using OdRxDynamicLinker::loadModule() and passing the module's name that was registered in the first argument to the ODRX_DEFINE_STATIC_APPLICATION macro. Note that all modules' .lib files must be linked with the application.

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.