📄 basic-mode-of-operation.html
字号:
<html><head><title>CHICKEN User's Manual - Basic mode of operation</title></head><body><a name="basic-mode-of-operation"></a><h1>Basic mode of operation</h1><p>The compiler translates Scheme source code into fairly portable C that can be compiled and linked with most available C compilers. CHICKEN supports the generation of executables and libraries, linked either statically or dynamically. Compiled Scheme code can be loaded dynamically, or can be embedded in applications written in other languages. Separate compilation of modules is fully supported.</p><p>The most portable way of creating separately linkable entities is supported by so-called <em>unit</em>s. A unit is a single compiled object module that contains a number of toplevel expressions that are executed either when the unit is the <em>main</em> unit or if the unit is <em>used</em>. To use a unit, the unit has to be <em>declare</em>ed as used, like this:</p><PRE>(declare (uses UNITNAME))</PRE><p>The toplevel expressions of used units are executed in the order in which the units appear in the <tt>uses</tt> declaration. Units may be used multiple times and <tt>uses</tt> declarations may be circular (the unit is initialized at most once). To compile a file as a unit, add a <tt>unit</tt> declaration:</p><PRE>(declare (unit UNITNAME))</PRE><p>When compiling different object modules, make sure to have one main unit. This unit is called initially and initializes all used units before executing its toplevel expressions. The main-unit has no <tt>unit</tt> declaration.</p><p>Another method of using definitions in separate source files is to <em>include</em> them. This simply inserts the code in a given file into the current file:</p><PRE>(include <B><FONT COLOR="#BC8F8F">"FILENAME"</FONT></B>)</PRE><p>Macro definitions are only available when processed by <tt>include</tt> or <tt>require-for-syntax</tt>. Macro definitions in separate units are not available, since they are defined at compile time, i.e the time when that other unit was compiled (macros can optionally be available at runtime, see <tt>define-macro</tt> in <a href="http://galinha.ucpel.tche.br/Non-standard macros and special forms" class="external">Substitution forms and macros</a>).</p><p>On platforms that support dynamic loading of compiled code ( Windows, most ELF based systems like Linux or BSD, MacOS X, and others) code can be compiled into a shared object <tt>.dll</tt>, <tt>.so</tt>, <tt>.dylib</tt>) and loaded dynamically into a running application.</p><p>Previous: <a href="getting-started.html" class="internal">Getting started</a> Next: <a href="using-the-compiler.html" class="internal">Using the compiler</a></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -