Difference between revisions of "ECL/Building libraries"
Warning: preg_match(): Compilation failed: group name must start with a non-digit at offset 8 in /home/www/web437/html/mediawiki/includes/MagicWord.php on line 902
From formgames wiki
< ECL
(Created page with "{{ECL/experiments message}} == Linux == TODO == Mac == TODO == Windows == === Usage === * Adapt the path of the batch file 'vcvars64.bat' in 'vsenv' to correspond to th...") |
(→Shared Libraries) |
||
Line 1: | Line 1: | ||
{{ECL/experiments message}} | {{ECL/experiments message}} | ||
+ | |||
+ | == Documentation == | ||
+ | |||
+ | * [http://ecls.sourceforge.net/new-manual/index.html ECL's reference manual] | ||
+ | ** [http://ecls.sourceforge.net/new-manual/ch32s04.html Building libraries] | ||
== Linux == | == Linux == | ||
Line 11: | Line 16: | ||
== Windows == | == Windows == | ||
− | === Usage === | + | === Static Libraries === |
+ | |||
+ | TODO | ||
+ | |||
+ | === Shared Libraries === | ||
+ | |||
+ | ==== Using asdf:make-build ==== | ||
+ | |||
+ | Related documentation: | ||
+ | |||
+ | * ECL Manual: [http://ecls.sourceforge.net/new-manual/re55.html asdf:make-build] | ||
+ | |||
+ | TODO | ||
+ | |||
+ | ==== Using 'compile-file' and 'c:build-shared-library' ==== | ||
+ | |||
+ | Sources: [http://formgames.org/lisp/ecl/examples/shared-library.tar.gz shared-library.tar.gz] | ||
+ | |||
+ | ===== Usage ===== | ||
* Adapt the path of the batch file 'vcvars64.bat' in 'vsenv' to correspond to the local installation of Microsoft Visual C++. | * Adapt the path of the batch file 'vcvars64.bat' in 'vsenv' to correspond to the local installation of Microsoft Visual C++. | ||
Line 26: | Line 49: | ||
</pre> | </pre> | ||
− | === hello-lisp.lisp === | + | ===== hello-lisp.lisp ===== |
<pre> | <pre> | ||
Line 32: | Line 55: | ||
</pre> | </pre> | ||
− | === hello.c === | + | ===== hello.c ===== |
<pre> | <pre> | ||
Line 59: | Line 82: | ||
</pre> | </pre> | ||
− | build.lisp | + | ===== Makefile ===== |
+ | |||
+ | <pre> | ||
+ | # ECL installation dir: | ||
+ | ECL_INSTALLATION_DIR = "C:/Users/dietrich/home/cs/lang/lisp/ecl/64/git/install" | ||
+ | |||
+ | # Compiler options: | ||
+ | # Adapted from output of: ecl-config.bat --cflags | ||
+ | COMPILER_OPTIONS = /EHsc /DGC_DLL /DGC_BUILD /nologo /D_CRT_SECURE_NO_DEPRECATE /Zi /D_DEBUG /MDd /Od -I"$(ECL_INSTALLATION_DIR)" | ||
+ | |||
+ | # Linker options: | ||
+ | # Adapted from output of: ecl-config.bat --libs | ||
+ | LINKER_OPTIONS = /incremental:no /nologo /nodefaultlib:libcmt /nodefaultlib:libcmtd /nodefaultlib:libc /nodefaultlib:libcd /debug /nodefaultlib:msvcrt.lib /LIBPATH:"$(ECL_INSTALLATION_DIR)" ecl.lib | ||
+ | |||
+ | hello.exe: hello.obj hello-lisp.lib | ||
+ | link $(LINKER_OPTIONS) hello.obj hello-lisp.lib | ||
+ | |||
+ | hello.obj: hello.c | ||
+ | cl /c $(COMPILER_OPTIONS) hello.c | ||
+ | |||
+ | hello-lisp.lib: hello-lisp.lisp | ||
+ | ecl -norc -load build.lisp | ||
+ | |||
+ | clean: | ||
+ | del hello.exe hello.obj hello.pdb vc100.pdb | ||
+ | del hello-lisp.data hello-lisp.h hello-lisp.c hello-lisp.obj | ||
+ | del hello-lisp.lib hello-lisp.dll | ||
+ | </pre> | ||
+ | |||
+ | ===== build.lisp ===== | ||
<pre lang=Lisp> | <pre lang=Lisp> | ||
Line 66: | Line 118: | ||
(c:build-shared-library "hello-lisp" :lisp-files '("hello-lisp.obj") :init-name "init_lib_HELLO_LISP") | (c:build-shared-library "hello-lisp" :lisp-files '("hello-lisp.obj") :init-name "init_lib_HELLO_LISP") | ||
(quit) | (quit) | ||
+ | </pre> | ||
+ | |||
+ | ===== vsenv ===== | ||
+ | |||
+ | <pre> | ||
+ | #!/usr/bin/bash | ||
+ | |||
+ | # Batch file for setting the Microsoft Visual Studio 10.0 environment | ||
+ | vcvars64bat="C:\Program Files (x86)\Microsoft Visual Studio 10.0/VC/bin/AMD64/vcvars64.bat" | ||
+ | |||
+ | # Temporary file | ||
+ | tmpfile="$TMP/tmp$$.bat" | ||
+ | tmpfile_win=$(cygpath -m "$tmpfile") | ||
+ | |||
+ | # Generating the batch file | ||
+ | cat > $tmpfile <<EOF | ||
+ | @echo off | ||
+ | call "${vcvars64bat}" | ||
+ | bash -c "%*" | ||
+ | EOF | ||
+ | |||
+ | # Executing the temporary batch file | ||
+ | cmd /c "${tmpfile_win} $@" | ||
+ | |||
+ | # Removing the temporary file | ||
+ | rm -f $tmpfile | ||
</pre> | </pre> |