G
gregarican
I am trying to use the Ruby/DL library to pass a C event buffer back
and forth. When using the struct! method not all of the method
prototypes are available from all I can tell.
Here's my code:
----------------------
def getEventPoll
# some stuff here
@eventBuf=DL.malloc(1024)
@eventBuf.struct!('LHHLLSI', :hndlPtr, :evtClsPtr, :evtTypPtr, /
:invIdPtr, :callIdPtr, :devIdPtr, :devIdTypPtr)
# other stuff here too
end
----------------------
This @eventBuf is an event buffer structure that should be comprised of
the following data types:
hndlPtr = long unsigned
evtClsPtr = short unsigned
evtTypPtr = short unsigned
invIdPtr = long unsigned
callIdPtr = long unsigned
devIdPtr = char[64]
devIdType = int
When I try to access the contents of the structure I get results with
everything but the :devIdPtr item. This comes up blank. I see the data
type should be char and not const char, but I cannot use 's' (lower
case) prototype in the struct! method. I get an error and have to use
the 'S' (upper case) prototype instead.
Any ideas? Any lower case prototypes used in the struct! method cause
the method to fail...
and forth. When using the struct! method not all of the method
prototypes are available from all I can tell.
Here's my code:
----------------------
def getEventPoll
# some stuff here
@eventBuf=DL.malloc(1024)
@eventBuf.struct!('LHHLLSI', :hndlPtr, :evtClsPtr, :evtTypPtr, /
:invIdPtr, :callIdPtr, :devIdPtr, :devIdTypPtr)
# other stuff here too
end
----------------------
This @eventBuf is an event buffer structure that should be comprised of
the following data types:
hndlPtr = long unsigned
evtClsPtr = short unsigned
evtTypPtr = short unsigned
invIdPtr = long unsigned
callIdPtr = long unsigned
devIdPtr = char[64]
devIdType = int
When I try to access the contents of the structure I get results with
everything but the :devIdPtr item. This comes up blank. I see the data
type should be char and not const char, but I cannot use 's' (lower
case) prototype in the struct! method. I get an error and have to use
the 'S' (upper case) prototype instead.
Any ideas? Any lower case prototypes used in the struct! method cause
the method to fail...