home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!crcnis1.unl.edu!crcnis1.unl.edu!manager
- From: mgleason@cse.unl.edu (Mike Gleason)
- Newsgroups: comp.sys.mac.programmer
- Subject: Think C & #pragma parameter (was: help calling assembly from C)
- Date: 25 Jan 1993 03:10:51 GMT
- Organization: NCEMRSoft
- Lines: 26
- Distribution: usa
- Message-ID: <1jvlnrINNst4@crcnis1.unl.edu>
- References: <2B6198C1.22487@news.service.uci.edu> <keith-240193173019@kip-50.taligent.com>
- NNTP-Posting-Host: cse.unl.edu
-
- keith@taligent.com (Keith Rollin) writes:
-
- |You came really close to answering your own question. You know that there
- |are Mac OS functions that work like this, so why don't you declare your
- |function the same way they are? For instance:
-
- |#pragma parameter DisposePtr(__A0)
- |pascal void DisposePtr(Ptr p);
-
- |This is an example of a function that simply takes a parameter in A0.
- |Here's a more complex example:
-
- |#pragma parameter __D0 HoldMemory(__A0,__A1)
- |pascal OSErr HoldMemory(void *address,unsigned long count);
-
- Well, I found out the hard way awhile back that this doesn't work like one
- would expect in Think C 5. Think C's #pragma parameter only works on "sub-
- sequent inline function definitions" (p. 194 of the manual). So in Think C,
- you can't really use this for your own functions unless you bother with crap
- like "void foo(void) = { 0x4e71, 0x4e71, etc... };" I wouldn't mind if Think
- C required the whole function to be in gazzembly, but accepting only raw hex
- is unacceptable.
-
- --
- ______________________________________________________________________________
- mike gleason mgleason@cse.unl.edu NCEMRSoft, baby!
-