home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!wupost!sdd.hp.com!mips!pacbell.com!well!oster
- From: oster@well.sf.ca.us (David Phillip Oster)
- Subject: Re: Using CODE rescource files
- Message-ID: <Bru380.Esn@well.sf.ca.us>
- Sender: news@well.sf.ca.us
- Organization: Whole Earth 'Lectronic Link
- References: <bHP-sfA@engin.umich.edu>
- Date: Thu, 23 Jul 1992 08:50:23 GMT
- Lines: 20
-
- Use think C to build a resourc with code in it, say type 'mCod'm id = 128.
- if it has a main procedure
- pascal vvoid main(short verb, long *result, ListHandle lh);
-
- then you call it form your main program with:
- Handle h;
- SignedByte state;
- long res;
-
- if(NIL != (h = GetResource('mCod', 128))){
- state = HGetState(h);
- HLock(h);
- CallPascal( 3, &res, lh, *h);
- HSetState(h, state);
- }
- For a main that is a C procedure, say:
- typedef void (*CodeResType_)(short verb, long *result, ListHandle lh);
-
- then, instead of the CallPascal line above, say:
- (* (CodeResType) *h)( 3, &res, lh);
-