So I have never seen a union before this. However, when reading a struct, you would write it in the BGT DLL call as a char* and read the struct as a string of bytes. Thus, to read something from the same address twice, you just access the same bytes from the string. It can be somewhat tricky to deref pointers, but for example with strings, we have the string_create_from_pointer function to do it for us. So if there were 4 bytes that could be read as a string and an int, you would run code that uses bitwise operations to convert the 4 bytes into a true int. Then you can both pass it to string_create_from_pointer and show the raw int in an alert box. Remember, all structs are once they are packed are a series of bytes. We can read these bytes as a BGT string to turn addresses that are shown in the struct to ints, then access them or pass them to other DLL functions. I unfortunetally can't give you code as I've never seen a union before, so I'll have to see what the byte sequence for one looks like and learn exactly how they work, but I would imagine it would be duable. Furthermore, I have not written any kind of include to read structs, I just have a messy implementation at this time that reads 4 chars from a string, converts them in an int, reads a byte and converts it to a bool, reads 4 bytes and converts it to a string with string_create_from_pointer, etc. So there is currently no pretty code that does it. However at some point I may attempt to make a struct class where you can call an add_value function, or pass a string representation of the fields to the classes constructor similar to what you would do in python. From what you've described of unions though it looks possible, though I have not messed with them myself.
I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com