You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The c-with macro has the keyword count, however the c-ref macro does not. The c-ref macro can only access an index of a member array of a struct, but not an array of structs.
(plus-c:c-with ((iovec (:struct (c:iovec)) :count 2))
(iovec 0 :iov-len))
; in: PLUS-C:C-WITH ((IOVEC (:STRUCT (C:IOVEC)) :COUNT 2))
; (IOVEC 0 :IOV-LEN)
; ==>
; (PLUS-C:C-REF #:TMP951 (:STRUCT (C:IOVEC)) 0 :IOV-LEN)
;
; caught ERROR:
; during macroexpansion of (PLUS-C:C-REF #:TMP951 (:STRUCT #) ...). Use
; *BREAK-ON-SIGNALS* to intercept.
;
; Error parsing ref: 0 on type #<AUTOWRAP:FOREIGN-RECORD IOVEC {1002173723}>
;
; compilation unit finished
; caught 1 ERROR condition
debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR in thread
#<THREAD "main thread" RUNNING {100301E883}>:
Execution of a form compiled with errors.
Form:
(PLUS-C:C-REF #:TMP951 (:STRUCT (C:IOVEC)) 0 :IOV-LEN)
Compile-time error:
during macroexpansion of (PLUS-C:C-REF #:TMP951 (:STRUCT #) ...). Use
*BREAK-ON-SIGNALS* to intercept.
Error parsing ref: 0 on type #<AUTOWRAP:FOREIGN-RECORD IOVEC {1002173723}>
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
((LAMBDA ()))
source: (IOVEC 0 :IOV-LEN)
0]
From the c-plus examples:
Is there a simpler way to access an element at an index from an array of structs?
Currently, I get a pointer first using
c-aptr
:A cleaner way would be something like:
The text was updated successfully, but these errors were encountered: