home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / 2253 < prev    next >
Encoding:
Text File  |  1992-08-19  |  2.0 KB  |  53 lines

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