[Cuis-dev] Unions inside structs

Javier Pimás elpochodelagente at gmail.com
Mon Dec 15 09:46:14 PST 2025


Hi folks,

I'm trying to define a wrapper (in cuis) of the following C struct:

typedef struct InteropData {
    uint64_t dataType;
    union {
        double quad;
        int32_t int32;
        uint32_t uint32;
        int64_t int64;
        uint64_t uint64;
        char16_t *wstr;
        void *ptr;
    };
} InteropData;  // size 24

for now I made an ExternalStructure subclass with the following method:

InteropData class >> #fields
    "
    self defineFields
    "
    ^#(
        (dataType 'uint64')
        (payload 'uint64')
    )

As you can see, the payload is a bag of cats, and I wonder if there's a way
to specify the union fields so that they get generated automatically.

Cheers,
Javier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20251215/1fe122e9/attachment.htm>


More information about the Cuis-dev mailing list