4.1.2 Creating foreign structure types
:typekeyword argument for a given slot in a foreign structure refers to the named slot type that exists at the time the slot is processed, not at the time that the new structure definition is processed. This distinction can lead to some confusion when redefining recursive types.
For example, suppose that
second are undefined foreign types. The following forms define the foreign types
second in terms of one another. Each of these types has three slots:
(def-foreign-struct first (a :type (:pointer second)) (b :type (:pointer first)) (c :type :single-float))If
(def-foreign-struct second (x :type (:pointer second)) (y :type (:pointer first)) (z :type :single-float))
secondis redefined as follows, there will be a third foreign type, also named
second, with three slots.
(def-foreign-struct second (x :type (:pointer second)) (y :type (:pointer first)) (z :type :double-float))To avoid this outcome, use the function
second, and then redefine both types.
Generated with Harlequin WebMaker