Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!helios.ee.lbl.gov!ux3.lbl.gov!beard From: beard@ux3.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Handling large applications as segments or using DAs Message-ID: <2240@helios.ee.lbl.gov> Date: 27 Mar 89 07:55:32 GMT References: <659@salgado.stan.UUCP> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux3.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 32 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!" \ + ---------------------------------------------------------------+