[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] gcl compile question 2

From: Camm Maguire
Subject: Re: [Gcl-devel] gcl compile question 2
Date: 13 Nov 2003 09:40:43 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  While it is certainly possible to call lisp functions from
a C program, as GCL is entirely based on C anyway, it will doubtlessly
require a lot of setup/initialization, as is currently done in main.c.  I
think you'll be better off calling your C functions from lisp.  There
are two ways of getting compiled C code into gcl:

1)  Put this in a lisp file and compile and load it:

        (clines "object foo_(object x,object y) {....; return z}")
        (defentry foo (object object) (object foo_))

2) Load externally compiled C modules into a new saved image:

        >(compiler::link nil "new_image_name" "" "foo.o bar.o")
        >(defentry .....)

You can then invoke your C functions as lisp functions, aka (as in the
first example)  (let ((z (foo x y))) ...).  

GCL lisp objects are pointers to unions of structures, as defined in
the object.h header file in the h/ subdir, and included in the
cmpinclude.h file in installed distributions.

Hope this helps,

Take care,

Suleyman O Turkyilmaz <address@hidden> writes:

> okey i can keep translated c file etc.
> but can i link compiled *.o to a c program ?
> and
> if can
> how can i call translated lisp fonctions from c programs
> -- 
> "Unix is user friendly not
>  idiot friendly"
> KernelHacker
> -------------------------------------------------
> This mail sent through IMP: http://webmail.students.itu.edu.tr
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel

Camm Maguire                                            address@hidden
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]