(From a thread on the [EMAIL PROTECTED] list, turning into an 
Inline thread)

On Thursday, August 15, 2002, at 01:59 PM, Nathan Torkington wrote:
> I thought I'd write an applescript dispatcher, basically a drop-in
> replacement for the system() calls everyone uses.  You pass the
> function some AppleScript, it runs it, and returns a value.

That would be nice.

> Apple helpfully have this code on their web pages:
>   http://developer.apple.com/qa/qa2001/qa1026.html
>
> So I made a C version. (attached)  Compile it with
>   % cc -o as1 as1.c 
> /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon

I couldn't figure out what that last argument was, so I dug 
through the cc docs for a while and it turns out it's "an object 
file to be fed straight into linking. Any file name with no 
recognized suffix is treated this way."

I didn't like that much, so I replaced it with "-framework 
Carbon", as in
   % cc -o as1 as1.c -framework Carbon

That seems to work fine for the C executable.  So I figured I'd 
try the same technique in Inline, but no go:

    use Inline C => 'DATA' =>
        LIBS => '-framework Carbon';

That gives me essentially the same error you got.

I looked in the 'out.make' file generated by Inline, and it 
turns out that the "-framework Carbon" chunk isn't in the 
compilation command at all.  I've had this problem before, with 
LIBS stuff getting dropped by Inline, but I'm not sure how to 
fix it.


> So, I thought, let's Inline the sucker.  The result is as2.plx, also
> attached.  This fails to compile, from what looks like clashing
> namespaces:
>
> System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/
> Headers/Quickdraw.h:2155: macro `Move' used with only 2 args
> /usr/include/gcc/darwin/2.95.2/g++/../stdbool.h:10: warning: 
> empty declarationIn file included from 
> /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/
> Headers/QD.h:41,
> /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/
> Headers/Quickdraw.h:2153: parse error before `void'

Yeah, looks like some perl stuff is conflicting with some 
Quickdraw stuff, of all things.  Maybe it's possible to just 
link in the AppleScript pieces instead of the entire Carbon 
behemoth?

> Also, feel free to steal the code and Make It Work and release the
> module on CPAN.

The next step, of course, is Inline::AppleScript. =)

  -Ken

Reply via email to