home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!stanford.edu!ames!ads.com!saturn!doug
- From: doug@saturn.ads.com (Doug Morgan)
- Subject: Re: Calling C function from LCL
- In-Reply-To: harry@issun1.kfk.de's message of 19 Aug 92 13:27:13 GMT
- Message-ID: <DOUG.92Aug19092520@saturn.ads.com>
- Sender: usenet@ads.com (USENET News)
- Organization: Advanced Decision Systems, Mountain View, CA 94043, +1 (415)
- 960-7300
- References: <Bt8G1E.229@iai.kfk.de>
- Date: Wed, 19 Aug 1992 17:25:20 GMT
- Lines: 39
-
- In article <Bt8G1E.229@iai.kfk.de> harry@issun1.kfk.de (Harald Kucharek) writes:
- I have the following little C program:
- ...
- ca(my_array)
- int my_array[2][2];
- ..
- which I want to call from LISP (I am using Lucid Common Lisp 4.0.1 on a SPARCstation330)
- I define:
-
- (def-foreign-function (run-ca (:return-type :signed-32bit)
- ...(my_array (:array :signed-32bit (4))))
- ...
- (setq a (make-array '(2 2) :element-type 'integer))
- ...
- Questions:
-
- 1) What is this missing symbol __DYNAMIC
- 2) The contents of the array are all multiplied by 4. Has this something
- to do with the type of the lisp object? I always thought, it is coded in the high order
- bits of the data.
- 3) What is wrong in my declaration of the foreign function, that make all these things happen?
-
- Harald
-
- The problem should be in your make-array. The type 'integer is very
- general and results in all elements being tagged. Instead, use
- '(signed-byte 32). Also, Lucid seems to use the low order two bits
- for type tags. I don't know what __DYNAMIC is.
-
- Also, I don't think 'fixnum even gives you what you want. Each fixnum
- in the array will have tag bits. (This is reaching back a ways for me
- and could easily be wrong.)
-
- doug
- --------------------------------------------------------------------
- Doug Morgan, doug@ads.com, (415) 960-7300
- Advanced Decision Systems (a division of Booz-Allen & Hamilton Inc.)
- 1500 Plymouth St., Mountain View, CA 94043-1230
- --------------------------------------------------------------------
-