From: Thomas Ioerger
Subject: calling C from lisp (KCL)
Date:
Message-ID: <Cn11LH.I9B@cs.uiuc.edu>
I've been using KCL's C interface fairly successfully.
Now I ran into a new problem. One of my C functions calls "send"
(it's for sockets). It compiles ok, but when I load it, I get
"undefined _send symbol". I think the problem is that the system
code for send is not linked into the lisp environment, unlike printf,
for example. Anybody know how to fix this? I think what I want is
to tell compile-file to link in send from libc.a with my fasl file.
But I just don't have enough info to figure it out.
Thanks,
Tom Ioerger
In article <··········@cs.uiuc.edu> ·······@sophocles.cs.uiuc.edu (Thomas Ioerger) writes:
>I've been using KCL's C interface fairly successfully.
>Now I ran into a new problem. One of my C functions calls "send"
>(it's for sockets). It compiles ok, but when I load it, I get
>"undefined _send symbol". I think the problem is that the system
>code for send is not linked into the lisp environment, unlike printf,
>for example. Anybody know how to fix this? I think what I want is
>to tell compile-file to link in send from libc.a with my fasl file.
>But I just don't have enough info to figure it out.
Load the .o file with si:faslink rather than load. You can then
specify the required libraries. E.g.
(si:faslink "somefile.o" "-lc")
-- jeff
From: Thomas Ioerger
Subject: Re: calling C from lisp (KCL)
Date:
Message-ID: <Cn2oxB.6u7@cs.uiuc.edu>
Several people responded with the following solution:
use si:faslink. For example, to load a compiled file
FILE.O, which calls send() from a C function, do the following:
(si:faslink "FILE.O" "-lc")
This links in any code for system calls. Someone mentioned that
this is unique to a BSD variant of KCL. I'm not sure what that
means, but it works for me. The other category of responses I
got were along the lines of "add something to the source code to
force linking in the code for a send() system call, and then
re-build KCL.
Thanks to all who helped.
Tom