Other scheme chicken5 , how to compile the produced c code of a scheme program to an executable.

Alain De Vos

Son of Beastie

Reaction score: 869
Messages: 2,826

Take for instance a scheme file : hello10.scm
(display 10)
To compile to c code :
$chicken5 ./hello10.scm
This produces a file hello10.c
How do I compile this hello10.c to an executable ?


Son of Beastie

Reaction score: 2,507
Messages: 3,370

In general: "cc -o hello10 hello10.c". This compiles directly from the C source code to an executable.

If there are multiple modules, one typically compiles them into object files first, then links the object files together: "cc hello10.c" creates hello10.o, and then "cc hello10.o other.o ... -o hello10" creates the hello10 executable from the object file hello10.o and other object files.

However, there are most likely scheme-specific include files (for the compile step) and libraries (for the link step) that need to be pulled in. The documentation for your scheme compiler should tell you what those are, and should give example compile lines.

In practice, one will use a make file to orchestrate all that. Again, the documentation should have example make files. It might be a good time to review make syntax and practice how to write make files.