[comp.sys.amiga.tech] "Snooping" library calls

jep@mtiame.oz (Jesper Peterson) (06/28/90)

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)

djh@metaphor.metaphor.com (Dallas Hodgson) (07/04/90)

In article <1816@vela.acs.oakland.edu> dlcogswe@vela.acs.oakland.edu (Dan Cogswell) writes:
>I would like to be able to examine the arguments passed to a library call,
>and then allow the library call to continue without being interrupted.
>Specifically, I'd like to do the following:
>
>  (1)  Intercept a call to "OpenFont"
>  (2)  Look at the TextAttr structure
>  (3)  Let the OpenFont call continue
>
>I have tried SetFunctioning the routine, which allows me to do (1) and (2),
>but (3) is the hard part.  IS there an easy way of doing it?

... This has been done many times by many people. Check out my MacGAG demo
on Fish disk 58. My ParSNAG routine works similarly, only with devices.