[plt-scheme] (no subject)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Aug 6 10:54:59 EDT 2006

At Sun, 6 Aug 2006 10:31:44 -0400, James wrote:
> I'm having a slight problem with mzc on my Mac OS X.  This is the  
> order of what I did:
> mzc -c first_scheme.scm
> mzc --cc first_scheme.c
> gcc first_scheme.o -o first_scheme -framework PLT_MzScheme
> That last command gives me this error:
> /usr/bin/ld: Undefined symbols:
> _main
> collect2: ld returned 1 exit status
> So I looked through the code and sure enough there is no main  
> function.  How is it supposed to compile?  Am I missing something here?

If your goal is to produce a stand-alone executable, make sure that
your program is in a `module', and then try

  mzc --exe first_scheme first_scheme.scm

to get a "first_scheme" executable. 

If you're compiling via C an an attempt to improve performance, and
assuming your using v350 or later, then mzc is not useful. MzScheme's
built in bytecode-to-native JIT reliably outperforms mzc compilation.
(But be sure to use `module' if you want good performance.)

Finally, if you really want to compile to C via mzc, try just

 mzc first_scheme.scm

which compiles .scm to .c, compiles .c to .o, and links the resulting
.o to .dylib --- so that the output is "first_scheme.dylib". But the
.dylib result is a Mzscheme extension (i.e., to be loaded into MzScheme
via `load-extension'), not an executable.


Posted on the users mailing list.