Ruby/DL struct! method prototypes

Discussion in 'Ruby' started by gregarican, Oct 13, 2005.

  1. gregarican

    gregarican Guest

    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...
    gregarican, Oct 13, 2005
    #1
    1. Advertising

  2. gregarican

    gregarican Guest

    gregarican, Oct 13, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lars Hedström

    Prototypes of html-pages

    Lars Hedström, Apr 8, 2004, in forum: HTML
    Replies:
    3
    Views:
    370
    Jim Roberts
    Apr 8, 2004
  2. Paul Davis
    Replies:
    2
    Views:
    302
    Paul Davis
    Jul 15, 2003
  3. Chris Fogelklou
    Replies:
    36
    Views:
    1,345
    Chris Fogelklou
    Apr 20, 2004
  4. Bill Cunningham

    prototypes and struct quest.

    Bill Cunningham, Feb 7, 2011, in forum: C Programming
    Replies:
    41
    Views:
    1,038
    Bill Cunningham
    Feb 17, 2011
  5. Claudio Freda
    Replies:
    5
    Views:
    134
    Robert Klemme
    Feb 19, 2010
Loading...

Share This Page