Accessing foreign type array slot value (ACL 5.0) 
Author Message
 Accessing foreign type array slot value (ACL 5.0)

Greetings,

Consider the following foreign type definition (Allegro CL 5.0):

(ff:def-foreign-type MQGMO
       (:struct
        (strucid (:array :char 4))
        (version :int)
        (options :int)
        (wait-interval :int)
        (signal-1 :int)
        (signal-2 :int)
        (resolved-q-name (:array :char 48))
        (match-options :int)
        (gs-status-block (:array :char 4))
        (msg-token (:array :unsigned-char 16))
        (returned-length :int)))

I've read through the documentation, but I'm stumped when it comes to
accessing the value of an array slot in the above foreign type. It
seems I can set the value of such a slot with the following:

(setf (ff:fslot-value obj 'msg-token)
   (make-array '(16) :element-type 'unsigned-byte :initial-element 0))

However, attempting to get the value back out of the structure yields
what appears to be a pointer value:

(ff:fslot-value obj 'msg-token)
=> 541039392

The documentation does mention #'ff:char*-to-string, but the msg-token
value is a 16-byte array -- not a C string. Is there a way to get such
a value back from a foreign structure slot?

-- Kaelin Colclasure



Sat, 16 Feb 2002 03:00:00 GMT  
 Accessing foreign type array slot value (ACL 5.0)
Greetings,

Consider the following foreign type definition (Allegro CL 5.0):

(ff:def-foreign-type MQGMO
       (:struct
        (strucid (:array :char 4))
        (version :int)
        (options :int)
        (wait-interval :int)
        (signal-1 :int)
        (signal-2 :int)
        (resolved-q-name (:array :char 48))
        (match-options :int)
        (gs-status-block (:array :char 4))
        (msg-token (:array :unsigned-char 16))
        (returned-length :int)))

I've read through the documentation, but I'm stumped when it comes to
accessing the value of an array slot in the above foreign type. It
seems I can set the value of such a slot with the following:

(setf (ff:fslot-value obj 'msg-token)
   (make-array '(16) :element-type 'unsigned-byte :initial-element 0))

However, attempting to get the value back out of the structure yields
what appears to be a pointer value:

(ff:fslot-value obj 'msg-token)
=> 541039392

The documentation does mention #'ff:char*-to-string, but the msg-token
value is a 16-byte array -- not a C string. Is there a way to get such
a value back from a foreign structure slot?

-- Kaelin Colclasure



Sat, 16 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Structure slot-init accessing previous slot

2. ACL Foreign Function Interface Question

3. ACL foreign inferface: calling function-pointers

4. Foreign function interface in ACL 3.0.2

5. ACL - foreign function interface

6. Copying one array value into subsequent array values

7. type is access cf type is access all?

8. Return value that is an access to array element

9. 64bit access to an array of 8bit values

10. Update on Search for ACL 5.0

11. ACL 5.0 and Emacs 20.x

12. Gabriel benchmarks for ACL 5.0, LWW 4.1.14, Cormanlisp 1.2

 

 
Powered by phpBB® Forum Software