<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">Getting closer. I now have ecl1.lisp:<br><br>(defun say-hello ()<br> (format *terminal-io* "hello world"))<br><br>which I compile using<br> ecl -compile ecl1.lisp<br><br><br>I also have ecl2.c:<br><br>#include <ecl/ecl.h><br>main()<br>{<br> cl_object form, result;<br> char* my_args[ 1 ] = { "ecl" };<br> const char *lisp_code = "(progn (load \"ec1.fas\") (say-hello))";<br> cl_boot( 1, my_args );<br><br> form = c_string_to_object(lisp_code);<br> result = si_safe_eval(3,form, Cnil, OBJNULL );<br> cl_shutdown();<br>}<br><br>which I compile using:<br> gcc -lelc ecl2.c<br><br>When I run a.out, though, it doesn't print "hello world" as I
would expect; although it now doesn't crash. I'm using Linux. Should I be doing things in a different way?<br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Goffioul Michael <goffioul@imec.be><br>To: Mark Carter <mcturra2000@yahoo.co.uk>; ecls-list@lists.sourceforge.net<br>Sent: Friday, 24 August, 2007 11:51:54 AM<br>Subject: RE: [Ecls-list] Getting "hello world" going<br><br>
<style type="text/css">DIV {
MARGIN:0px;}
</style>
<div dir="ltr" align="left"><span class="528235110-24082007"><font color="#0000ff" face="Arial" size="2">You have to initialize ECL engine before calling ECL
functions. Use</font></span></div>
<div dir="ltr" align="left"><span class="528235110-24082007"><font color="#0000ff" face="Arial" size="2">cl_boot for this.</font></span></div>
<div dir="ltr" align="left"><span class="528235110-24082007"><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span class="528235110-24082007"><font color="#0000ff" face="Arial" size="2">Michael.</font></span></div>
<div dir="ltr" align="left"><span class="528235110-24082007"></span> </div><br>
<blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div class="OutlookMessageHeader" dir="ltr" align="left" lang="en-us">
<hr tabindex="-1">
<font face="Tahoma" size="2"><b>From:</b> ecls-list-bounces@lists.sourceforge.net
[mailto:ecls-list-bounces@lists.sourceforge.net] <b>On Behalf Of </b>Mark
Carter<br><b>Sent:</b> Friday 24 August 2007 11:50<br><b>To:</b> Mark Carter;
ecls-list@lists.sourceforge.net<br><b>Subject:</b> Re: [Ecls-list] Getting
"hello world" going<br></font><br></div>
<div></div>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">I
know I'm being a bit vague here, but it's not really happening for me. .
Suppose, instead, I have hello.c:<br><br>#include
<ecl/ecl.h><br><br>main()<br>{<br> cl_object form,
result;<br> form = c_string_to_object("(+ 1 2)");<br> result =
si_safe_eval(4,form, Cnil, OBJNULL );<br>}<br><br>and I compile it
using<br> gcc -lecl hello.c<br>When I
type<br> ./a.out<br>I get<br> Segmentation
Fault<br><br><br>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">-----
Original Message ----<br>From: Mark Carter
<mcturra2000@yahoo.co.uk><br>To:
ecls-list@lists.sourceforge.net<br>Sent: Friday, 24 August, 2007 12:07:18
AM<br>Subject: [Ecls-list] Getting "hello world" going<br><br>
<div style="font-size: 12pt; font-family: times new roman,new york,times,serif;">
<div>I am trying to call Lisp code from C.<br><br>Suppose I have the Lisp file
sayhello.lisp:<br><br>(defun say-hello () <br> (print "hello
world"))<br><br><br>and a C file
hello.c:<br><br>main()<br>{<br> say_hello(); /* ??
*/<br>}<br><br>How do I compile everything into a program so that it all
works? <br></div></div><br>
<hr size="1">
Yahoo! Answers - Get better answers from someone who knows. <a rel="nofollow" target="_blank" href="http://uk.answers.yahoo.com/;_ylc=X3oDMTEydmViNG02BF9TAzIxMTQ3MTcxOTAEc2VjA21haWwEc2xrA3RhZ2xpbmU">Try it now</a>.</div><br></div></div><br>
<hr size="1">
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy
and free. <a rel="nofollow" target="_blank" href="http://us.rd.yahoo.com/mail/uk/taglines/yahoo_com/trueswitch/*http://uk.docs.yahoo.com/trueswitch2.html">Do
it now...</a></blockquote></div><br></div></div><br>
<hr size=1>
For ideas on reducing your carbon footprint visit <a href="http://uk.promotions.yahoo.com/forgood/environment.html">Yahoo! For Good</a> this month.
</body></html>