source: project/wiki/eggref/5/compile-file @ 38051

Last change on this file since 38051 was 38051, checked in by sjamaan, 7 weeks ago

Add try-compile to compile-file egg docs for C5

File size: 3.7 KB
Line 
1[[tags: egg]]
2
3== compile-file
4
5[[toc:]]
6
7This egg provides a way to do on-the-fly compilation of source code
8and load it into the running process.
9
10=== Usage
11
12==== compile-file
13
14<procedure>(compile-file FILENAME #!key options output-file load)</procedure>
15
16Compiles the Scheme source file {{FILENAME}} into a dynamically
17loadable library by invoking the {{csc}} compiler driver. If the
18library can be successfully created and {{load}} is not given or
19true, the file is loaded into the current
20Scheme process. {{options}} may be a list of strings which are passed
21as additional command line options to {{csc}}. If {{output-file}} is
22not given, then the compiled file is stored in a temporary location
23and will be deleted when the process exits successfully.
24When compilation and loading succeeds, the name of the compiled file
25is returned, otherwise {{#f}} is returned.
26
27Notes:
28
29* loading the same compiled file multiple times is only supported on Linux
30  in the moment and should be considered unreliable. For this reason, a new temporary
31  file is created for every invocation of {{compile-file}}, unless an explicit
32  output file name is given.
33
34* this procedure is compatible to the {{scheme-compile-file}} command in {{emacs}}' {{scheme-mode}}.
35
36==== compile-file-options
37
38<parameter>compile-file-options</parameter>
39
40A parameter that holds a list of default options that should be given
41to {{csc}} after invocation of the {{compile-file}} procedure.
42The initial default options are {{-scrutinize -O2 -d2}}.
43
44
45==== try-compile
46
47<procedure>(try-compile CODE #!key cc cflags ldflags compile-only c++)</procedure>
48
49Returns {{#t}} if the C code in {{CODE}} compiles and links successfully, or {{#f}} otherwise.
50The keyword parameters {{cc}} (compiler name, defaults to the C compiler used to build this system),
51{{cflags}} and {{ldflags}} accept additional compilation and
52linking options. If {{compile-only}} is true, then no linking step takes place.
53If the keyword argument {{c++}} is given and true, then the code will be compiled in C++ mode.
54
55{{compile-file-options}} is **not** used.
56
57=== Author
58
59The CHICKEN Team
60
61=== License
62
63  Copyright (c) 2018, The CHICKEN Team
64  All rights reserved.
65 
66  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following
67  conditions are met:
68 
69    Redistributions of source code must retain the above copyright notice, this list of conditions and the following
70      disclaimer.
71    Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
72      disclaimer in the documentation and/or other materials provided with the distribution.
73    Neither the name of the author nor the names of its contributors may be used to endorse or promote
74      products derived from this software without specific prior written permission.
75 
76  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
77  OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
78  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
79  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
80  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
81  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
82  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
83  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
84  POSSIBILITY OF SUCH DAMAGE.
85
86=== Version History
87
88; 1.0 : Taken from the utils unit and released as an egg for CHICKEN 5.
Note: See TracBrowser for help on using the repository browser.