G
gregarican
I read the Ruby/DL docs on using the struct! method and have an
understanding about it. How about the union! method? I have googled
around and can't find any examples of its use. The following test code
doesn't seem to work:
--------------------------
require 'dl'
thisStruct=DL.malloc(4)
thisStruct.struct!('L', :longPointer)
thatStruct=DL.malloc(2)
thatStruct.struct!('H', :shortPointer)
theUnion=DL.malloc(6)
theUnion.union!(thisStruct, thatStruct)
Reading the RDoc entries for the union! method it appears to work the
same as the struct! method. First pass along the data types, next pass
along the element names. But I thought a union just connects existing
structs. How does that work with the first parameter of data types?
Does anyone out there have some example they can provide that will
accomplish what my test code is trying to do?
understanding about it. How about the union! method? I have googled
around and can't find any examples of its use. The following test code
doesn't seem to work:
--------------------------
require 'dl'
thisStruct=DL.malloc(4)
thisStruct.struct!('L', :longPointer)
thatStruct=DL.malloc(2)
thatStruct.struct!('H', :shortPointer)
theUnion=DL.malloc(6)
theUnion.union!(thisStruct, thatStruct)
Reading the RDoc entries for the union! method it appears to work the
same as the struct! method. First pass along the data types, next pass
along the element names. But I thought a union just connects existing
structs. How does that work with the first parameter of data types?
Does anyone out there have some example they can provide that will
accomplish what my test code is trying to do?