Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!austing From: austing@Apple.COM (Glenn L. Austin) Newsgroups: comp.sys.mac.programmer Subject: Re: Can LSC call a Pascal function pointer? Keywords: LSC,Pascal functions Message-ID: <30290@apple.Apple.COM> Date: 8 May 89 16:32:46 GMT References: <1491@internal.Apple.COM> Organization: Apple Computer Inc, Cupertino, CA Lines: 29 In article <1491@internal.Apple.COM> rpd@Apple.COM (Rick Daley) writes: >OK, everyone knows that you can create a function that follows Pascal >calling conventions by using the "pascal" keyword. But, what if you >want to declare a pointer to one of these functions and then call it? >I'm using LSC 3.0 and I can't figure out how to do it. I even resorted >to looking through the manual. > >In MPW, I can do this: > >typedef pascal long (*routinePtr)(OSErr err, ushort ignoreThis); > >But in LSC, I can't get the compiler to accept either the "pascal" keyword >or a parameter list in the typedef. The only solution I know of is to >call the routine via inline assembler. What's a poor programmer to do? What I do is write a front-end caller for LSC which uses a "generic" procedure definitions for the pascal function pointer, then set the pointer to the value passed into my call, then make the call. I haven't had to resort to assembly to do any of this, it is simply C code (although I admit it is rather ugly). ----------------------------------------------------------------------------- | Glenn L. Austin | The nice thing about standards is that | | Apple Computer, Inc. | there are so many of them to choose from. | | Internet: austing@apple.com | -Andrew S. Tanenbaum | ----------------------------------------------------------------------------- | All opinions stated above are mine -- who else would want them? | -----------------------------------------------------------------------------