Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'pascal' keyword not accepted in typedefs



On 10/1/05 4:37 PM, Robert Slifka didst favor us with:

> Hi all,
> 
> I'm working hard at understanding a device vendor's API, and am surprised
> how much trouble I'm having just getting their project to build.  Sheesh!
> 
> The error I get is "parse error before EntryProc".  If I remove the 'pascal'
> keyword, the program builds, but crashes as soon as any of these typedefs
> are used.  I suspect they put the pascal there for a reason!

Well, yes, all callbacks in Mac OS require this (read some headers). The
reasons are related to how parameters were passed on the stack in pascal vs.
C many moons ago. Nowadays I think the keyword is just there for
compatibility with code that uses the declaration. As I understand it, Xcode
just macros it away with something like this:

#define pascal

CW does not, though, so you'd have to add your own "pascal" killer or use it
for callbacks. What development environment are you using?

Larry

> 
> #ifdef __cplusplus
> extern "C" {    // Tell C++ to use C linking for these functions
> #endif
> 
> // Callback Functions
> typedef pascal EntryProc (DeviceIDObject pObject, long iCmd);
> 
> #ifdef __cplusplus
> }
> #endif
> 
> Thanks in advance,
> 
> Rob

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >'pascal' keyword not accepted in typedefs (From: Robert Slifka <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.