[Ecls-list] Embedding ECL library in C program

_ _ swarogich at bk.ru
Tue Sep 4 14:14:17 UTC 2007


I'm trying to build a simple "hello world"-like example, but not doing very well so far.
Here is my C code:

//prog_msg.c

#include <stdio.h>
#include <ecl/ecl.h>

int main(int argc,char** argv)
{
  cl_object res;
  cl_boot(argc,argv);

  res=eval("(get-msg-text)");
  printf("%s",(char*)res->string.self);
  cl_shutdown();
  return 0;
}

and ECL library code:

//test.lisp

(defpackage "TEST"
(:use "COMMON-LISP")
(:nicknames "TEST")
(:export "GET-MSG-TEXT"))

(in-package test)

(defun get-msg-text()
(values "Hello from ECL!"))

I'm getting this error in the first step of the building process:

$ gcc -I/usr/share/lib/ecl -c prog_msg.c
prog_msg.c: In function 'main':
prog_msg.c:9: warning: assignment makes pointer from integer without a cast
prog_msg.c:10: error: 'union cl_lispunion' has no member named 'string'

What am I doing wrong?




More information about the ecl-devel mailing list