ECL: Compile Lisp to C

Discussion of other useful tools
Post Reply
imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

ECL: Compile Lisp to C

Post by imba » Thu Nov 25, 2010 7:40 am

Hi,

i followed the instructions in http://ecls.sourceforge.net/new-manual/ch24s06.html and compiled a .lisp file into .fas and .o files, and finally into an executable (Ubuntu 10.10). But how can I produce a .c file?

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: ECL: Compile Lisp to C

Post by ramarren » Thu Nov 25, 2010 11:21 am

imba wrote:But how can I produce a .c file?
The .c file is obviously produced during compilation, because otherwise it wouldn't be possible to produce the .o file. It is the deleted, because it is not really designed for human consumption. I am not sure if there is exposed interface for suppressing the deletion, but you can set the c::*delete-files* variable to NIL. Just don't expect the .c files to be comprehensible unless you already know something about ECL code generator.

imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

Re: ECL: Compile Lisp to C

Post by imba » Thu Nov 25, 2010 11:33 am

Thank you!

Paul Donnelly
Posts: 148
Joined: Wed Jul 30, 2008 11:26 pm

Re: ECL: Compile Lisp to C

Post by Paul Donnelly » Sat Nov 27, 2010 6:23 pm

If you just want to see the code generated for a particular function, I think DECOMPILE can show you that in ECL. Something like that; it's in the manual.

imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

Re: ECL: Compile Lisp to C

Post by imba » Sun Nov 28, 2010 4:56 pm

Ramarren wrote:
imba wrote:But how can I produce a .c file?
The .c file is obviously produced during compilation, because otherwise it wouldn't be possible to produce the .o file. It is the deleted, because it is not really designed for human consumption. I am not sure if there is exposed interface for suppressing the deletion, but you can set the c::*delete-files* variable to NIL. Just don't expect the .c files to be comprehensible unless you already know something about ECL code generator.
Strange: This doesn't work on Debian. Is there a way to prevent *my-program*.c and .h from being deleted?

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: ECL: Compile Lisp to C

Post by ramarren » Sun Nov 28, 2010 11:48 pm

What exactly did you do? Also, are you looking in a correct place? Temporary files, which, as I said, the .c and .h files are from ECL perspective, might be somewhere under /tmp/ or ~/.fasls or whatever. Look at compilation commands which scroll by while compiling anything with ECL.

imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

Re: ECL: Compile Lisp to C

Post by imba » Mon Nov 29, 2010 1:12 pm

I wrote a bash script, which creates a backup of the .c/.h files after being written to them.

Now I have another question: Did anyone manage to compile ECL on Windows using MSVC++? I get the error "msvcrt.lib" not found (by nmake), although ...\VC\lib is in PATH.

TheGZeus
Posts: 79
Joined: Mon Jun 30, 2008 10:46 am

Re: ECL: Compile Lisp to C

Post by TheGZeus » Mon Nov 29, 2010 4:50 pm

imba wrote:I wrote a bash script, which creates a backup of the .c/.h files after being written to them.

Now I have another question: Did anyone manage to compile ECL on Windows using MSVC++? I get the error "msvcrt.lib" not found (by nmake), although ...\VC\lib is in PATH.
It's designed to work with GCC iirc.
Probably a number of GNU-isms in the code.

imba
Posts: 35
Joined: Sun Nov 21, 2010 2:13 pm

Re: ECL: Compile Lisp to C

Post by imba » Tue Nov 30, 2010 12:59 pm

I found a working Windows version: http://ecls.wikispaces.com/VCExpress

Post Reply