Path: utzoo!utgpu!watserv1!watmath!att!pacbell!pacbell.com!ucsd!swrinde!zaphod.mps.ohio-state.edu!wuarchive!cec2!rah0777 From: rah0777@cec1.wustl.edu (Rexford Alan Hill) Newsgroups: comp.sys.mac.programmer Subject: CODE Resources Message-ID: <1990Jul10.150727.19895@cec1.wustl.edu> Date: 10 Jul 90 15:07:27 GMT Sender: news@cec2 (USENET News System) Distribution: na Organization: Washington University, St. Louis MO Lines: 44 I am currently building an application in which I would like for the user to be able to add "modules" to it. Each module would have code for perf- orming some specific task. I think I want to build code resources and install them in the resource fork of the application in order to do this, but I'm not sure how to deal with them. Here's what I've done so far: In THINK C 3.xx I build a code resource of type XFRM and gave it an ID and a name. In THINK C 3.xx I wrote a quick and dirty application to open a window and create a menu bar. In one of the menus, I AddResMenu with a type of 'XFRM'. This adds the name of any resources of type XFRM that the Mac finds. Then, I load the resource. I have a handle to it, and I typecast the handle to be a (void **) (after locking it of course). I have a variable named procP that is typed as follows: void (*procP)(); And I set procP to point to the resource: procP = *handleName; I then attempt to call procP (the code resource I built had a main with no parameters, so I cal procP with no parameters). (*procP)(); The code resource was supposed to draw a line diagonally in the window: main() { MoveTo(10,10); LineTo(50,50); } But, of course, nothing happens. Am I declaring things correctly? Am I calling the thing correctly? When the code resource is loaded in, is it just a piece of code that I can point to, or is there something else there? IM gives no hints that I could find, and the THINK manual explains building code resources, but not calling them from within another program. Any help would be greatly aprreciated. P.S. I am also open to any suggestions for better ways to handle a 'growable' application. -rex Rexford A. Hill Student, Washington University (in St. Louis) rah0777@cec2.wustl.edu rex@dworkin.wustl.edu rex@wuccrc.wustl.edu