Ruby/DL struct! method prototypes

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top