ml10+@andrew.cmu.edu (Michael A. Libes) (11/08/90)
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..." What is the correct way to link this code resource? ------------------------------------------------------------------ Michael Libes (Luni) Internet Address: MacMach Project ml10@andrew.cmu.edu Carnegie Mellon University ------------------------------------------------------------------
robinson@cs.wvu.wvnet.edu (John Robinson) (11/08/90)
In article <QbC66U200UhBE2xKdl@andrew.cmu.edu>, 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...
andyp@treehouse.UUCP (Andy Peterman) (11/08/90)
In article <QbC66U200UhBE2xKdl@andrew.cmu.edu> ml10+@andrew.cmu.edu (Michael A. Libes) writes: >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..." > >What is the correct way to link this code resource? Don't use globals. The data initialization routine is used for initializing globals (at least to zero). If you're using strings, use the -b or -b2 option to put these strings within the code. Check out Tech Note 256 for a good explanation of writing stand-alone code. -- Andy Peterman | Opinions expressed treehouse!andyp@gvgpsa.gvg.tek.com | are definitely those of (916) 273-4569 | my employer!
Jim.Lynch@f444.n161.z1.FIDONET.ORG (Jim Lynch) (11/15/90)
Hi, Can I use globals such as randSeed in an app? Thanx in advance, Jim -- Jim Lynch - via FidoNet node 1:125/777 UUCP: ...!uunet!hoptoad!fidogate!161!444!Jim.Lynch INTERNET: Jim.Lynch@f444.n161.z1.FIDONET.ORG