[CM] Specifying struct types in cload.scm C entities

Brad Christensen bchristensen-lists at outlook.com
Mon Sep 20 16:44:06 PDT 2021

Hello again.

With regards to cload.scm, the documentation states:
"If the C type has a space ("struct tm*"), use (symbol "struct tm*") to construct the corresponding symbol."

I  perform this advice while describing C functions which deal with structure types as arguments and return values, but receive an error. For example, within a c-define:
(void function_taking_struct_ptr ((symbol "struct some_structure_type*")))

results in an error of likeness:
;symbol->string argument, "struct some_structure_type*", is a string but should be a symbol
;    (do ((i 0 (+ i 1)) (type arg-types...
;    /some/path/to/cload.scm, line 344, position: 14199
; C-type->s7-type: (do ((i 0 (+ i 1)) (type... ; type: "struct some_structure_type*"
; add-one-function: ((s7-type (C-type->s7-t...
; add-one-function: (((i 0 (+ i 1)) (type a...
; add-one-function: ((if (pair? return-type... ; return-type: void
;                                              func-name: "function_taking_struct_ptr"
;                                              p: #<output-file-port>
;                                              double-funcs: ()
;                                              scheme-name: "function_taking_struct_ptr"
;                                              int-funcs: ()
;                                              double-int-funcs: ()
;                                              functions: (("other_funcs...

Perhaps I've taken this usage out of context, and it is only meant for use when the C entity is a constant? I could not find uses of `(symbol "struct ...")` in any of the included 'lib*.scm'. Does dealing with struct types require 'in-C' ?

Thank you for the clarification,

More information about the Cmdist mailing list