chickadee » compile-file

compile-file

This egg provides a way to do on-the-fly compilation of source code and load it into the running process.

Usage

compile-file

compile-file FILENAME #!key options output-file loadprocedure

Compiles the Scheme source file FILENAME into a dynamically loadable library by invoking the csc compiler driver. If the library can be successfully created and load is not given or true, the file is loaded into the current Scheme process. options may be a list of strings which are passed as additional command line options to csc. If output-file is not given, then the compiled file is stored in a temporary location and will be deleted when the process exits successfully. When compilation and loading succeeds, the name of the compiled file is returned, otherwise #f is returned.

Notes:

  • loading the same compiled file multiple times is only supported on Linux in the moment and should be considered unreliable. For this reason, a new temporary file is created for every invocation of compile-file, unless an explicit output file name is given.
  • this procedure is compatible to the scheme-compile-file command in emacs' scheme-mode.

compile-file-options

compile-file-optionsparameter

A parameter that holds a list of default options that should be given to csc after invocation of the compile-file procedure. The initial default options are -scrutinize -O2 -d2.

try-compile

try-compile CODE #!key cc cflags ldflags compile-only c++procedure

Returns #t if the C code in CODE compiles and links successfully, or #f otherwise. The keyword parameters cc (compiler name, defaults to the C compiler used to build this system), cflags and ldflags accept additional compilation and linking options. If compile-only is true, then no linking step takes place. If the keyword argument c++ is given and true, then the code will be compiled in C++ mode.

compile-file-options is not used.

Author

The CHICKEN Team

License

 Copyright (c) 2018, The CHICKEN Team
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
 conditions are met:
 
   Redistributions of source code must retain the above copyright notice, this list of conditions and the following
     disclaimer.
   Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
     disclaimer in the documentation and/or other materials provided with the distribution.
   Neither the name of the author nor the names of its contributors may be used to endorse or promote
     products derived from this software without specific prior written permission.
 
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.

Version History

1.3
Fix behaviour of try-compile when verbose flag is #f.
1.0
Taken from the utils unit and released as an egg for CHICKEN 5.

Contents »