Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!uflorida!haven!cs.wvu.wvnet.edu!robinson From: robinson@cs.wvu.wvnet.edu (John Robinson) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW 3.1 and stand-alone code Summary: Reference to Tech Note that should solve the poster's problem. Message-ID: <976@h.cs.wvu.wvnet.edu> Date: 8 Nov 90 05:10:51 GMT References: Sender: news@cs.wvu.wvnet.edu Lines: 32 In article , ml10+@andrew.cmu.edu (Michael A. Libes) writes: > I'm writing an adev to implement a network device. > I wrote the adev rsrc in Assembly and it works fine. > I'm writing the atlk rsrc in Assembly and C and can't get it to link. > The entry point has to be in Assembly, but I don't want to write the > whole thing in Assembly, so I do some calls to C functions. > > The problem comes at link time. If I include the Runtime.o library I get: > "Data intialization not called..." > If I remove that library I get: > "No data intialization routine..." > Well I am not sure but it sounds like you are using global variables in your code resource. The is a definate no-no when writing standalone code *unless* you follow the guidelines set down in Tech Note 256, Globals in Stand-Alone Code. It seems that the problem arises from the fact that the ToolBox uses the A5 register to point to a 64k area of memory that contains various things such as an applications jumptable, globals and other good stuff. Since you are using the same heap as an application when your stand-alone code resouce is called; Your code cannot use the A5 register to point to its global data. The MPW linker flags this as an error and returns the message you indicated above. The Solution is laid out in pretty staight forward terms in TN 256. Hope this helps...