mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-24 05:21:20 -08:00
doc typos (building.txi)
This commit is contained in:
parent
2877ffde65
commit
32fbbd69a4
1 changed files with 27 additions and 28 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
@node System building
|
||||
@section System building
|
||||
|
||||
|
|
@ -20,10 +19,10 @@ In this section we will introduce topics on compiling Lisp programs. ECL
|
|||
is especially powerful on combining lisp programs with C programs. You
|
||||
can embed ECL as a lisp engine in C programs, or call C functions via
|
||||
@ref{Foreign Function Interface}. We explain file types generated by
|
||||
some compilation approaches. GNU/Linux system and gcc as a development
|
||||
some compilation approaches. A GNU/Linux system and gcc as a development
|
||||
environment are assumed.
|
||||
|
||||
You can generate following files with ECL.
|
||||
You can generate the following files with ECL:
|
||||
|
||||
@enumerate
|
||||
@item Portable FASL file (.fasc)
|
||||
|
|
@ -46,9 +45,9 @@ Relations among them are depicted below:
|
|||
@cindex Portable FASL
|
||||
|
||||
ECL provides two compilers (bytecodes compiler, and C/C++
|
||||
compieler). Portable FASL files are build from source lisp files by the
|
||||
compiler). Portable FASL files are built from source lisp files by the
|
||||
bytecodes compiler. Generally FASC files are portable across
|
||||
architectures and operating systems providing convenient way of shipping
|
||||
architectures and operating systems providing a convenient way of shipping
|
||||
portable modules. Portable FASL files may be concatenated, what leads to
|
||||
bundles. FASC files are faster to compile, but generally slower to run.
|
||||
|
||||
|
|
@ -86,13 +85,13 @@ bundles. FASC files are faster to compile, but generally slower to run.
|
|||
@cfindex --enable-shared [YES|no]]
|
||||
|
||||
|
||||
If you want to make a library which is loaded dynamically from lisp
|
||||
program, you should choose fasl file format. Under the hood native fasls
|
||||
If you want to make a library which is loaded dynamically from a lisp
|
||||
program, you should choose the fasl file format. Under the hood native fasls
|
||||
are just a shared library files.
|
||||
|
||||
This means you can load fasl files with @code{dlopen} and initialize it
|
||||
by calling a init function from C programs, but this is not an intended
|
||||
usage. Recommended usage is loading fasl files by calling load lisp
|
||||
usage. The recommended usage is to load fasl files by calling the load lisp
|
||||
function. To work with @emph{Native FASL files} ECL has to be compiled
|
||||
with @code{--enable-shared} configure option (enabled by default).
|
||||
|
||||
|
|
@ -126,11 +125,11 @@ c:build-fasl.
|
|||
@node Object file
|
||||
@subsubsection Object file
|
||||
|
||||
Object file works as an intermediate file format. If you want to compile
|
||||
Object files work as an intermediate file format. If you want to compile
|
||||
more than two lisp files, you might better to compile with a :system-p t
|
||||
option, which generates object files (instead of a fasl).
|
||||
|
||||
On linux systems, ECL invokes gcc -c for generating object files.
|
||||
On linux systems, ECL invokes gcc -c to generate object files.
|
||||
|
||||
An object file consists of some functions in C:
|
||||
|
||||
|
|
@ -168,7 +167,7 @@ randomized and not user-friendly. This is because object files are not
|
|||
intended to be used directly.
|
||||
|
||||
ECL provides other user-friendly ways to generate compiled lisp programs
|
||||
(as static/shared libraries or executable), and in each approach, object
|
||||
(as static/shared libraries or executables), and in each approach, object
|
||||
files act as intermediate files.
|
||||
|
||||
@node Static library
|
||||
|
|
@ -191,9 +190,9 @@ with some compiled object files.
|
|||
:init-name "init_hello_goodbye")
|
||||
@end lisp
|
||||
|
||||
When you use static/shared library, you have to call init functions. The
|
||||
name of the function is specified by @code{:init-name} option. In this
|
||||
example, @code{init_hello_goodbye} is it. The usage of this function is
|
||||
When you use a static/shared library, you have to call its init function. The
|
||||
name of this function is specified by the @code{:init-name} option. In this
|
||||
example, it is then @code{init_hello_goodbye}. The usage of this function is
|
||||
shown below:
|
||||
|
||||
@exindex Initializing static/shared library in C/C++
|
||||
|
|
@ -223,15 +222,15 @@ main(int argc, char **argv)
|
|||
|
||||
Because the program itself does not know the type of the init function,
|
||||
a prototype declaration is inserted. After booting up the lisp
|
||||
environment, invoke @code{init_hello_goodbye} via
|
||||
@code{read_VV}. @code{init_hello_goodbye} takes a argument, and read_VV
|
||||
environment, it invokes @code{init_hello_goodbye} via
|
||||
@code{read_VV}. @code{init_hello_goodbye} takes an argument, and read_VV
|
||||
supplies an appropriate one. Now that the initialization is finished, we
|
||||
can use functions and other stuffs defined in the library.
|
||||
|
||||
@node Shared library
|
||||
@subsubsection Shared library
|
||||
|
||||
Almost the same as the case of static library. User has to use
|
||||
Almost the same as with a static library. The user has to use
|
||||
@code{c:build-shared-library}:
|
||||
|
||||
@exindex Building shared library
|
||||
|
|
@ -250,10 +249,10 @@ Almost the same as the case of static library. User has to use
|
|||
@node Executable
|
||||
@subsubsection Executable
|
||||
|
||||
ECL supports executable file generation. To create a standalone
|
||||
executable from lisp programs, compile all lisp files to object
|
||||
ECL supports the generation of executable files. To create a standalone
|
||||
executable from a lisp program, compile all lisp files to object
|
||||
files. After that, calling @code{c:build-program} creates the
|
||||
executable.
|
||||
executable:
|
||||
|
||||
@exindex Building executable
|
||||
@lisp
|
||||
|
|
@ -267,24 +266,24 @@ executable.
|
|||
:lisp-files '("hello.o" "goodbye.o"))
|
||||
@end lisp
|
||||
|
||||
Like native FASL, program may be built also from libraries.
|
||||
Like with native FASL, the program may be built also from libraries.
|
||||
|
||||
@node Summary
|
||||
@subsubsection Summary
|
||||
|
||||
In this post, some file types that can be compiled to with ECL were
|
||||
introduced. Each file type has adequate purpose:
|
||||
In this post, some file types that can be compiled with ECL were
|
||||
introduced. Each file type has an adequate purpose:
|
||||
|
||||
@itemize
|
||||
@item Object file: intermediate file format for others
|
||||
@item Fasl files: loaded dynamically via load lisp function
|
||||
@item Fasl files: loaded dynamically via the @code{load} lisp function
|
||||
@item Static library: linked with and used from C programs
|
||||
@item Shared library: loaded dynamically and used from C programs
|
||||
@item Executable: standalone executable
|
||||
@end itemize
|
||||
|
||||
ECL provides a high-level interface @code{c:build-*} for each native
|
||||
format. In case of @emph{Portable FASL} bytecodes compiler is needed.
|
||||
format. In case of @emph{Portable FASL} the bytecodes compiler is needed.
|
||||
|
||||
@node Compiling with ASDF
|
||||
@subsection Compiling with ASDF
|
||||
|
|
@ -298,7 +297,7 @@ system definitions.
|
|||
|
||||
To download dependencies you may use Quicklisp to load your system
|
||||
(with dependencies defined). Make sure you can successfully load and
|
||||
run your library in ECL REPL (or @code{*slime-repl*}). Don't worry
|
||||
run your library in the ECL REPL (or @code{*slime-repl*}). Don't worry
|
||||
about other libraries loaded in your image – ECL will only build and
|
||||
pack libraries your project depends on (that is, all dependencies you
|
||||
put in your @code{.asd} file, and their dependencies - nothing more,
|
||||
|
|
@ -319,7 +318,7 @@ location already recognized by ASDF).
|
|||
@node Build it as an single executable
|
||||
@subsubsection Build it as an single executable
|
||||
|
||||
Use this in REPL to make a executable:
|
||||
Use this in the REPL to make an executable:
|
||||
|
||||
@lisp
|
||||
(asdf:make-build :example-with-dep
|
||||
|
|
@ -342,7 +341,7 @@ Factorial of 5 is: 120
|
|||
@node Build it as shared library and use in C
|
||||
@subsubsection Build it as shared library and use in C
|
||||
|
||||
Use this in REPL to make a shared library:
|
||||
Use this in the REPL to make a shared library:
|
||||
|
||||
@lisp
|
||||
(asdf:make-build :example-with-dep
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue