Invoking a Method in Another Object Class

SOMAny *RecordClass;                            /* Class object pointer  */
somID  idQueryMethod;                           /* Method id             */

CHAR   szQueryBuffer[100];                      /* Query data buffer     */
PVOID  pFindData;                               /* Returned data buffer  */
   :
   :
rc = DosAllocSharedMem(&pFindData,              /* Alloc shared memory   */
                       NULL,                    /* No name               */
                       sizeof(szQueryBuffer)+1, /* Size of memory object */
                       OBJ_GIVEABLE  |          /* Make object giveable  */
                       PAG_WRITE     |          /* Allow write access    */
                       PAG_READ      |          /* Allow read access     */
                       PAG_COMMIT);             /* Commit storage now    */

strcpy(pFindData,szQueryBuffer);                /* Copy data to buffer   */

RecordClass = _somFindClass(SOMClassMgrObject,  /* Get class obj pointer */
                            SOM_IdFromString("Record"),
                                             1,1));
idQueryMethod = SOM_IdFromString("clsQuery");   /* Get method id         */

_somDispatchL(RecordClass,                      /* Invoke method         */
              idQueryMethod,                    /* Method id             */
              (void *)0,                        /* No descriptor string  */
              pFindData,                        /* Method parameters     */
              somSelf);


[Back: Class Method Example]
[Next: A SOM Precompiler-generated Function Stub]