Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!uhccux!virtue!comp.vuw.ac.nz!munnari.oz.au!mtiame!jep From: jep@mtiame.oz (Jesper Peterson) Newsgroups: comp.sys.amiga.tech Subject: Re: "Snooping" library calls Message-ID: <241@mtiame.oz> Date: 28 Jun 90 03:21:38 GMT References: <1816@vela.acs.oakland.edu> <137809@sun.Eng.Sun.COM> Organization: Metal Trades Industry Association, Victoria, Australia. Lines: 30 In article <137809@sun.Eng.Sun.COM> cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) writes: [SetFunction() example deleted] |Now the tricky parts (and the code above will be different for every |function and I don't believe I got my register keywords right!) are |that SetFunction() returns a pointer to a library entrypoint. That |means as a function it is expecting its parameters in registers and |_not_ on the stack like C would like to put them. The same is true |for "newfunc". Lattice C allows you to code these kinds of procedures |in "C" by using a bunch of vendor optional keywords to tell the |compiler how to make the calls. If you are using Manx you will have |to write a little assembly code stub to do the actual call after |putting the parameters in registers. Manx 5.0 also allows this with: #pragma regcall(newFunc(d0,d1)) Change register names as appropriate. This must be "visible" both where newFunc is called and declared/defined (pick one), and will cause the function to only expect the return address on the stack. I didn't see the original post so I'm not sure if the poster has already said he/she is using Manx 3.6, in which case ignore this. -- ACSnet: jep@mtiame.mtia.oz UUCP: ...!uunet!munnari!mtiame.oz!jep [Diamanda Galas] Makes Nina Hagen look like Kylie Minogue. - katefans@world.std.com (Chris'n'Vickie of Kansas City)