Re: Figuring out enums and structs with foreigners

Diogo via Chicken-users <[email protected]>
Newsgroups gmane.lisp.scheme.chicken
Message-ID <[email protected]>
Hi Felix,

On Sun, Mar 23, 2025 at 08:23:30PM +0100, felix.winkelmann--- via Chicken-users wrote:
> the internals of modules, but foreigners happens to define foreign types
> so that the defined entities can be used in foreign function declarations.

Yeah, I noticed that (define-external (foo (TYPE arg)) ...) works for a TYPE
defined with foreigners being it a struct or an enum. I think that is what you
meant. And this precisely my use case, I am trying to write my own
define-external.

> (define-syntax ftype
>   (er-macro-transformer
>     (lambda (x r c)
>       ;; retrieve registered foreign type
>       (print `(,(cadr x) ,(chicken.compiler.support#lookup-foreign-type (cadr x))))
>       #t)))

It looks dangerous, indeed. I'll use with care. Thank you for the tip.

Regards,
-Diogo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.