This sets up ECL to be used for compile time C code spilicing.
To compile:
- Download tarball from from https://ecl.common-lisp.dev/
- Extract
- Read the instructions in
INSTALL
file. The ones that I followed were: - Go to
msvc
- Run
nmake ECL_WIN64=1
- Run
nmame install ECL_WIN64=1
- The compilation output is in the
package
directory. Add this directory toPATH
To use:
-
Open the
Native Tools Command Prompt
from MSVC install and add ECL'spackage
directory inPATH
variable. -
Make a
build
directory and copyecl.dll
,ecl.lib
andencodings
from ECL'spackage
directory to thebuild
directory. -
Download the
test.lisp
,test.asd
andtest.c
files from this gist. -
Run
ecl
to enter REPL, an run the following code:-
(ext:install-c-compiler)
-
(require 'asdf)
-
(push "./" asdf:*central-registry*)
-
(asdf:make-build :test :type :static-library :move-here #P"./build/lisp" :init-name "LISP_init_test")
-
(quit)
This can all be done in one go using
ecl -norc ^ -eval "(ext:install-c-compiler)" ^ -eval "(require 'asdf)" ^ -eval "(push \"./\" asdf:*central-registry*)" ^ -eval "(asdf:make-build :test :type :static-library :move-here #P\"./build/lisp\" :init-name \"LISP_init_test\")" ^ -eval "(quit)"
-
-
Run the following commands (change the include path to ECL's
package
directory):cl /MD /I ecl-24.5.10\msvc\package test.c /c /Fobuild\test.obj
cl build\test.obj build\lisp\test.lib /Febuild\test.exe build\ecl.lib
-
Run the executable by
build\test
>build\test 0.46126956 0.46126956 0.4612695550331807d0