HP WBEM Services Software Developer's Kit for HP-UX Provider and Client Developer's Guide A.01

Provider Implementation
The Provider Programming Interfaces
Chapter 472
Handling Error Conditions
All errors must be reported to the CIM Server by throwing an exception.
The exception codes are listed in the API documentation in the Software
Developers Kit, in the /opt/wbem/html directory.
PegasusCreateProvider and the Provider Class
Constructor and Destructor
As previously discussed, a provider is an instance of a C++ class derived
from one or more of the provider interfaces. When the CIM Server needs
to invoke a provider function for the first time, after loading the
appropriate shared library (if it has not already been loaded), it will call
PegasusCreateProvider() with the name of the provider specified in
the corresponding instance of PG_Provider. There must be exactly one
PegasusCreateProvider entry point in a shared library, regardless of
how many CIM classes may be served and regardless of how many C++
provider classes may be implemented.
PegasusCreateProvider() must return a pointer to an instance of the
C++ provider class that will handle requests for the specified provider.
The C++ provider instance can be created with new (so-called heap
storage), or statically (an example is shown below). If the provider
instance was created with new, it must be explicitly deallocated by a
delete this; statement at the end of the provider's terminate() function.
However, if it was created statically, it must not be explicitly deallocated
with delete.
The provider source fragment shown in the section on Provider
Registration and Naming illustrates how PegasusCreateProvider may
be coded, creating the provider instance with new. The fragments below
show static provider allocation.
Example 4-10 Code fragment showing static allocation of a provider instance
// class declaration for Example Provider
class ExampleProvider : public CIMInstanceProvider
{
...
};
...
// global static instantiation - exists in shared library
// and comes into existence when shared library is loaded.
// Note that the use of the "static" storage class