SOM Kernel Reference 1-111
C Example
#include <som.h>
/*
* 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”;
/*
* Filenames will be different for AIX, OS/2 and Windows
*
* Set animalfile to ”C:\\MYDLLS\\ANIMAL.DLL” for OS/2
* or Windows.
* 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.
*/
Original Class
SOMClassMgr
Related Information
Methods: somFindClass
Commenti su questo manuale