6.7. Making Standalone Executables
|
(lsh/compiler/make-standalone.lsh) |
Author(s): Yann LeCun
Lush provides a rudimentary way to generate standalone executable
programs from a set of compiled Lush functions.
6.7.0. (make-standalone lushfile cdir executable main-func)
|
(lsh/compiler/make-standalone.lsh) |
generate a standalone C program that contains all the functions in lush
file lushfile . All the necessary C
source files will be written in directory cdir
. The directory will be created if necessary. Generating the executable
program can be done by cd-ing to cdir
and typing "make". The resulting executable file will be called
executable . The argument main-func
is a string that indicates the name of the Lush function that should
become the "main" function of the resulting C program.
This main function must be defined as:
(de mymain (ac av)
((-int-) ac)
((-gptr- "char **") av)
...body...
(to-int some-number))
(dhc-make () mymain)
6.7.1. low-level support functions for make-standalone
|
(lsh/compiler/make-standalone.lsh) |
6.7.1.0. (lushc.lsh-to-c fname)
|
(lsh/compiler/make-standalone.lsh) |
get the name of the .c file that corresponds to a .lsh file. This does
not check if the C file actually exists, it merely returns its supposed
path. This simply turns a string of the form "blah/asd.lsh" into a
string of the form "blah/C/asd.c".
6.7.1.1. (lushc.o-to-c oname)
|
(lsh/compiler/make-standalone.lsh) |
get the name of the compiler-generated .c file that corresponds to a .o
file. This does not check if the .c file actually exists, it merely
returns its supposed path. This simply turns a string of the form
"blah/C/i686-pc-linux-gnu/asd.o" into a string of the form
"blah/C/asd.c".
6.7.1.2. (lushc.c-to-o cname)
|
(lsh/compiler/make-standalone.lsh) |
get the name of the .o file that corresponds to a compiler-generated .c
file. This does not check if the files actually exist. This simply turns
a string of the form "blah/C/asd.c" into a string of the form
"blah/C/i686-pc-linux-gnu/asd.o".
6.7.1.3. (lushc.find-module oname)
|
(lsh/compiler/make-standalone.lsh) |
return the module that corresponds to a .o file.
oname must be an absolute path. The module must be mod-loaded
beforehand. This function returns nil if no suitable module is found.
6.7.1.4. (lushc.get-parent-modules themodule)
|
(lsh/compiler/make-standalone.lsh) |
get all the modules on which a module is directly dependent. return them
as a set (a htable).
6.7.1.5. (lushc.get-ancestors-m themodule)
|
(lsh/compiler/make-standalone.lsh) |
get all the modules on which a module is dependent, directly or
indirectly. Return the result as a set (a htable).