[plt-scheme] mzc's ++ldf flag

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 25 19:40:53 EST 2006

At Sun, 26 Nov 2006 01:25:54 +0100, Jakub Piotr Cłapa wrote:
> I have a problem with the ++ldf flag of mzc:
> #v+
> jpc at jpc ~/Projects/avr] mzc --exe avrp ++ldf "-framework IOKit -lusb"
> avrp.scm
> mzc version 360, Copyright (c) 2004-2006 PLT Scheme Inc.
>   [output to "avrp"]
> [jpc at jpc ~/Projects/avr] otool -L avrp
> 
> avrp:
>          /Users/jpc/Desktop/PLT
> Scheme/lib/PLT_MzScheme.framework/Versions/360/PLT_MzScheme
> (compatibility version 0.0.0, current version 0.0.0)
>          /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 71.1.4)
> #v-
> 
> So it seems to completely ignore this flag (I assume it should link to
> libusb and IOKit). ++ldl usb doesn't work either. It seems mzc doesn't
> call the linker at all because adding nonsense flags doesn't result in
> any errors (kdump also doesn't show any execves).

Right: mzc in --exe mode doesn't call the linker. The ++ldf and ++ldl
flags are used with modes like --ld.

It would be better for mzc to complain when flags are supplied that are
not used in the current mode, and I'll try improving mzc along those
lines. (It would be even better for mzc to use a syntax where an
argument specifies the mode, instead of a flag, but we'll have get that
right next time.)

> The libusb is loaded by means of foreign.ss which fails to load IOKit
> automaticaly so I tried to link it by hand in hope it will find the
> symbols.

I think you'll need to use

  (ffi-lib "/System/Library/Frameworks/IOKit.framework/IOKit")

to get a handle to the IOKit library, indendent of whether you build a
stand-alone executable with `mzc --exe'.

Matthew



Posted on the users mailing list.