From: Martin J. Zaidel
Subject: Two Lucid Foreign Function problems (with errata :-)
Date: 
Message-ID: <54120@netnews.upenn.edu>
(Reposted with corrections. Sorry to anyone seeing this twice.)

I've run into two problem with Lucid's Foreign Function Interface that someone
out there may know the answer to:

1. I'm trying to load a non-standard C library:  that is, a library which isn't
in one of the system directories /lib, /usr/lib, or /usr/local/lib.  Thus, when
I try:

>(lcl::load-foreign-libraries nil `("-lhash" "-lc"))

I get the following error:

Error: None of (/lib/libhash.a /usr/lib/libhash.a
/usr/local/lib/libhash.a) is an archive.

Somewhere, LOAD-FOREIGN-LIBRARIES is given a list of directories to look in.
I'd like to add my directory to that list, kind of like the -I option to cc.
Is this possible?

2.  In defining a foreign structure db, I need to define a slot of the C type
VOID:

	struct db {
		int slot1;
		void *slot2;
	} DB;

but there's no corresponding type for the DEF-FOREIGN-STRUCT:

	(lcl::def-foreign-struct db
				 (slot1 :type :signed-32bit)
				 (slot2 :type ?????))
					      ^^^^^
Any ideas?

Many thanks.

Martin J. Zaidel               *  If a train station is where a train stops,
==> ······@cis.upenn.edu       *  what happens at a workstation?
                               *  

From: Barry Margolin
Subject: Re: Two Lucid Foreign Function problems (with errata :-)
Date: 
Message-ID: <kgbsirINNokg@early-bird.think.com>
In article <·····@netnews.upenn.edu> ······@muzungu.cis.upenn.edu (Martin J. Zaidel) writes:
>1. I'm trying to load a non-standard C library:  that is, a library which isn't
>in one of the system directories /lib, /usr/lib, or /usr/local/lib.  Thus, when
>I try:
>
>>(lcl::load-foreign-libraries nil `("-lhash" "-lc"))

Just give the name of the library, without the "-l" prefix, and with the
".a" suffix.

>Somewhere, LOAD-FOREIGN-LIBRARIES is given a list of directories to look in.
>I'd like to add my directory to that list, kind of like the -I option to cc.
>Is this possible?

It's using the same list of directories that the Unix linker uses.  In both
cases, -l<whatever> is a shorthand for searching for <whatever>.a in the
above directories.

>2.  In defining a foreign structure db, I need to define a slot of the C type
>VOID:
>
>	struct db {
>		int slot1;
>		void *slot2;
>	} DB;
>
>but there's no corresponding type for the DEF-FOREIGN-STRUCT:
>
>	(lcl::def-foreign-struct db
>				 (slot1 :type :signed-32bit)
>				 (slot2 :type ?????))

????? == :POINTER

Caveat: I haven't actually tried either of these lately, but I think
they're both correct answers.
-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar
From: Mayank Prakash
Subject: Re: Two Lucid Foreign Function problems (with errata :-)
Date: 
Message-ID: <1739@sousa.ltn.dec.com>
······@muzungu.cis.upenn.edu (Martin J. Zaidel) writes:
: (Reposted with corrections. Sorry to anyone seeing this twice.)
: 
: I've run into two problem with Lucid's Foreign Function Interface that someone
: out there may know the answer to:
: 
: 1. I'm trying to load a non-standard C library:  that is, a library which isn't
: in one of the system directories /lib, /usr/lib, or /usr/local/lib.  Thus, when
: I try:
: 
: >(lcl::load-foreign-libraries nil `("-lhash" "-lc"))
: 
: I get the following error:
: 
: Error: None of (/lib/libhash.a /usr/lib/libhash.a
: /usr/local/lib/libhash.a) is an archive.
: 

You need to say 

>  (load-foreign-libraries nil '("/foo/bar/libhash.a" "-lc"))

i.e., give the full path name of the library. 

: 2.  In defining a foreign structure db, I need to define a slot of the C type
: VOID:
: 
: 	struct db {
: 		int slot1;
: 		void *slot2;
: 	} DB;
: 
: but there's no corresponding type for the DEF-FOREIGN-STRUCT:

Type void * in C is essentially same as char *, so (:pointer :character)
should work.

  -mayank.

+--------------------------------------------------------------------------+
| InterNet: ·······@aiag.enet.dec.com                                      |
| UUCP:     ...!decwrl!aiag.enet.dec.com!Prakash                           |
| VoiceNet: (508) 480.5458                                                 |
| BitNet:   prakash%aiag.enet at decwrl.dec.com                            |
| SnailNet: DEC, 111 Locke Drive LMO2-1/D12, Marlboro, MA 01752		   |
+--------------------------------------------------------------------------+

Disclaimer: The above is probably only line noise, and does not reflect the 
            opinions of anybody, including mine, far less my employer's.
--

  -mayank.

+--------------------------------------------------------------------------+
| InterNet: ·······@aiag.enet.dec.com                                      |
| UUCP:     ...!decwrl!aiag.enet.dec.com!Prakash                           |
| VoiceNet: (508) 480.5458                                                 |
| BitNet:   prakash%aiag.enet at decwrl.dec.com                            |
| SnailNet: DEC, 111 Locke Drive LMO2-1/D12, Marlboro, MA 01752		   |
+--------------------------------------------------------------------------+

Disclaimer: The above is probably only line noise, and does not reflect the 
            opinions of anybody, including mine, far less my employer's.