Is overloading (union) structures available?

Is there a way to overload (union) structures?

I am working on some declare’s with structures that are overloaded - or in Windows parlance are Union. The structure is IN_ADDR which is used in Sockets: IN_ADDR

struct in_addr { union { struct { u_char s_b1; u_char s_b2; u_char s_b3; u_char s_b4; } S_un_b; struct { u_short s_w1; u_short s_w2; } S_un_w; u_long S_addr; } S_un; };

There is a conversation from a couple of years ago which shows a way to make different structures just by adding different values (1, 2, etc.) at c-style-unions-in-xojo.

If nothing has changed then I’ll just use the different suffix number. Does anyone have a way to make overloading (union) structures work in Xojo?

Thanks :slight_smile:

Not that I’m aware of, you need to make separate structs and use them in the right place or as the post mentions detect which is needed, usually by data in the struct then use the right one.

Thanks Julian!

Heh
I was just about to write a blog post with a “How To” and see that your following my old post anyway :slight_smile:

Would seem this should be in an “Advanced Guide” but the “Advanced Guide” in the docs doesnt mention that at all