Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!bbn.com!nic!chaos.cs.brandeis.edu!chaos.cs.brandeis.edu!phils From: phils@chaos.chaos.cs.brandeis.edu (Phil Shapiro) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW->Think C typedef pascal ... Message-ID: Date: 1 Feb 91 21:30:37 GMT References: <1991Jan30.002237.18618@csn.org> Sender: @chaos.cs.brandeis.edu Organization: Symantec Corp. Lines: 30 In-Reply-To: bernard@boulder.colorado.edu's message of 30 Jan 91 00:22:37 GMT In article <1991Jan30.002237.18618@csn.org> bernard@boulder.colorado.edu (Bernie Bernstein) writes: How does one map the following typedef from MPW to Think C? typedef pascal void (*myfunction)(short *a, char *b); The compiler says "Invalid Storage Class" unless I remove the "pascal" part. I assume the pascal part is important because I use this type to extract functions from resources which use pascal conventions. The current version of Think C (v4.02) is very dumb about function pointers. It doesn't know about function pointer argument lists, and it also can't distinguish between "pascal" and "C" -typed functions. The reason ThC complained about the "storage class" is because ThC treats "pascal" as a storage class, like "static" or "auto". The moral to this story is: unless you're calling a function through a function pointer, you can always use ProcPtr. The only thing that ThC checks is the function's return type, so you may need different function pointers for this purpose. If you're calling a function through a function pointer, then you'll have to use CallPascal(), unless it's a C-style function pointer. -phil -- Phil Shapiro Technical Support Analyst Language Products Group Symantec Corporation Internet: phils@chaos.cs.brandeis.edu