Foundation > Dynamic Modules > IlvModule: The Dynamic Module Class
 
IlvModule: The Dynamic Module Class
Every dynamic module is an instance of a subclass of the IlvModule base class, defined in the header file <ilviews/base/modules.h>.
Every dynamic module must define one and only one subclass. The constructor of this class is called when Rogue Wave® Views loads the module, making it possible to perform all the static initializations that the module requests (graphic classes registration, for example).
Once you have declared (in a public header file) and defined your module class, you have to enable Rogue Wave Views to load it. To do so, add a call, outside the body of any function, to the macro ILVINITIALIZEMODULE, providing the class name of the module that you have defined as its only parameter.
Dynamic Module Code Skeleton
The skeleton of a Rogue Wave Views dynamic module is the following:
#include <ilviews/base/modules.h>
 
// Pre-initialization code goes here
// This is, typically, the declaration of global variables or
// static data members.
 
class MyModule
: public IlvModule {
public:
MyModule(void*)
{
// Initialization code goes here
}
};
 
ILVINITIALIZEMODULE(MyModule);
The parameter that is provided to the constructor of the module class makes it possible for you to send application-dependent data to your module initialization. This is required if your module needs external data to initialize properly. We will clarify this point later in this chapter (see the section Explicit Mode).
Note: Most of the time, the complete initialization of a module has to be split into two parts: the declaration of variables, outside the code of any function, and their initialization, which may require function calls, that must appear in the module constructor.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.