somFindClsInFile - Example Code

#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 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. */


[Back: somFindClsInFile - Related Methods]
[Next: somFindClsInFile - Topics]