Jump to content

somUnregisterClass

From EDM2
Revision as of 19:41, 12 October 2017 by Martini (talk | contribs) (Created page with "{{DISPLAYTITLE:somUnregisterClass}} This method removes a class object from the SOM run-time class registry. '''Note:''' For backward compatibility, this method does not take...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This method removes a class object from the SOM run-time class registry.

Note: For backward compatibility, this method does not take an Environment parameter.

Original Class
SOMClassMgr

Syntax

long somUnregisterClass (SOMClassMgr receiver, SOMClass class)

Parameters

receiver (SOMClassMgr)
Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).
class (SOMClass)
A pointer to the class to be unregistered.

Return Code

rc (long)
The somUnregisterClass method returns 0 for a successful completion, or non-zero to denote failure.

Remarks

The somUnregisterClass method unregisters a SOM class and frees the class object. If the class was dynamically loaded, it is also unloaded using somUnloadClassFile (which causes its entire affinity group to be unloaded as well).

Example Code

#include <som.h>

void main ()
{
    long rc;  /* Return code */
    SOMClass animalClass;

    /* The next 2 lines declare a static form of somId */
    string animalClassName = "Animal";
    somId animalId = &animalClassName;

    somEnvironmentNew ();
    animalClass = SOMClassMgr_somFindClass (SOMClassMgrObject,
                                                animalId, 0, 0);
    if (!animalClass) {
       somPrintf ("Could not load class.\n");
       return;
    }
    rc = SOMClassMgr_somUnregisterClass (SOMClassMgrObject,
                                                   animalClass);
    if (rc)
        somPrintf ("Could not unregister class, error code: %ld.\n",
                                                                rc);
    else
        somPrintf ("Class successfully unloaded.\n");
}

Related

Methods