SomFindClsInFile

This method finds a class object for a class.

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


 * Original Class : SOMClassMgr

Syntax
 SOMClass somFindClsInFile (SOMClassMgr receiver, somId classId, long majorVersion, long minorVersion, string file) 

Parameters

 * receiver (SOMClassMgr) : Usually SOMClassMgrObject (or a pointer to an instance of a user-supplied subclass of SOMClassMgr).


 * classId (somId) : The somId representing the name of the class.


 * majorVersion (long) : The class's major version number.


 * minorVersion (long) : The class's minor version number.


 * file (string) : A string representing the filename to be used if dynamic loading is required.

Return Code

 * rc (SOMClass) : A pointer to the requested class object, or NULL if the class could not be found or created.

Remarks
The somFindClsInFile method returns the class object for the specified class. This method is the same as somFindClass except that the caller provides the filename to be used if dynamic loading is needed.

If the requested class has not yet been created the somFindClsInFile method attempts to load the class dynamically by loading the specified library and invoking its "new class" procedure.

If majorVersion and minorVersion are not both zero, they are used to check the class version information against the caller's expectations. An implementation is compatible with the specified version numbers if it has the same major version number and a minor version number that is equal to or greater than minorVersion.

Example Code
 /*                                           */ /*  This program loads a class and creates    */ /* an instance of it without requiring the   */ /* binding (.h) file for the class. */ /*                                           */ void main {  SOMObject myAnimal; SOMClass animalClass; char *animalName = "Animal";
 * 1) include 

/*        * Filenames will be different for AIX and OS/2 * Set animalfile to "C:\\MYDLLS\\ANIMAL.DLL" for OS/2. * Set animalfile to "/mydlls/animal.dll" for AIX. */

char *animalFile = "/mydlls/animal.dll";    /* AIX filename */

somEnvironmentNew; animalClass = _somFindClsInFile (SOMClassMgrObject,                                   somIdFromString(animalName),                                    0, 0,                                    animalFile); myAnimal = _somNew (animalClass); somPrintf("The class of myAnimal is %s.\.n",      _somGetClassName(myAnimal)); _somFree(myAnimal); }  /*   Output from this program:  */ /*  The class of myAnimal is Animal. */ 

Methods

 * somFindClass