dce@stan.UUCP (David Elliott) (03/23/89)
I'm working on an application that is made up of several distinct parts, only a couple of which need to be active at a given time. The basic program reads and writes a specific file format, handles the data storage, and displays the data. In addition, there are modules for aquiring new data, filtering the data, and modifying the data. At any given time, only one of these special modules is needed. Is there a way to segment my application so that I only keep the code segments needed in memory? I suspect that this application is going to eventually have a lot of modules, so I'd like to be able to pull them in as needed. I guess what I'm really asking is how to do overlays with the Mac. Alternatively, would it be possible to write the modules as desk accessories and have them communicate with the main program through temp files? How easy is this to do, and what are the traps into which I might fall? -- David Elliott ...!pyramid!boulder!stan!dce "Splish splash, I was rakin' in the cash" -- Eno
beard@ux3.lbl.gov (Patrick C Beard) (03/27/89)
In article <659@salgado.stan.UUCP> dce@stan.UUCP (David Elliott) writes: >I'm working on an application that is made up of several distinct >parts, only a couple of which need to be active at a given time. [description deleted] >Is there a way to segment my application so that I only keep the >able to pull them in as needed. > >David Elliott ...!pyramid!boulder!stan!dce >"Splish splash, I was rakin' in the cash" -- Eno Two ways to do it: 1) Place all of the code for the different modules into different segments. To load the segment with the appropriate module, just call a routine in the segment. To remove it from memory, just call UnLoadSeg(routineAddr); with routineAddr as one of the routines in the segment. This is what the Segment loader is for. (How do you think they got MacPaint in to 128k?) 2) Write each module as separate code resources, and load them into memory directly, under program control. Load them, call them, release them. Method 1 has the advantage of allowing the modules access to global variables, and simplifying the program, while method two allows you to separately develop the modules and add the resources as they become available (and allow others to develop them if you publish the specs). So, it depends on what you really want to do. +----------------------------------------------------------------+ \ Patrick Beard "Badges? \ \ Berkeley Systems, Inc. I ain't got to show you... \ \ PCBeard@lbl.gov ...NO STINKING BADGES!" \ + ---------------------------------------------------------------+