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
INSTALLfile. 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
packagedirectory. Add this directory toPATH
To use:
-
Open the
Native Tools Command Promptfrom MSVC install and add ECL'spackagedirectory inPATHvariable. -
Make a
builddirectory and copyecl.dll,ecl.libandencodingsfrom ECL'spackagedirectory to thebuilddirectory. -
Download the
test.lisp,test.asdandtest.cfiles from this gist. -
Run
eclto 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
packagedirectory):cl /MD /I ecl-24.5.10\msvc\package test.c /c /Fobuild\test.objcl 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