[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] unix daemon in gcl
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] unix daemon in gcl |
Date: |
19 Jul 2004 10:18:52 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings!
Pascal J.Bourguignon <address@hidden> writes:
> Hello,
>
> I need to write a couple of small unix daemons (sockets, posix shared
> memory, posix semaphores, mmap, etc). I'd rather write them in
> Common-Lisp so I'm having a look at gcl.
>
> How can we call unix syscalls or functions (from man2 or man3) from
> gcl? Is there documentation or an example somewhere?
>
Take a look at pcl/impl/gcl/pcl_gcl_low.lisp.
> I've found defcfun and defentry but they seem to be defined as empty
> macros. Or does it mean that I can use them only in compiled code, not
> in the REPL?
>
Yes, C code cannot be interpreted.
> I tried:
>
> (compile 'unix-open
> '(defcfun unix-open "int unix_open(char*n n,int f,int m)" 0
> "return open(n,f,m);"))
>
> (unix-open (make-array (length "/tmp/a.lisp") :element-type 'character
> :initial-contents "/tmp/a.lisp") 1 0)
>
These forms won't go through compile, at least not at present. Rather
please stick them in a file and use compile-file. You can keep the C
code to look at with :c-file t. Also, look at (clines "....")
>
>
> But I get this puzzling error:
>
> >(compile 'unix-open
> '(defcfun unix-open "int unix_open(char*n n,int f,int m)" 0
> "return open(n,f,m);"))
>
>
> Error: def not a lambda expression
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by COND.
> Broken at ERROR. Type :H for Help.
>
Please keep us posted. An interesting project!
Take care,
>
>
> --
> __Pascal Bourguignon__ http://www.informatimago.com/
>
> There is no worse tyranny than to force a man to pay for what he does not
> want merely because you think it would be good for him. -- Robert Heinlein
>
>
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gcl-devel
>
>
>
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah