from "int cfunc(char *data,int *num) " how can I get the value of'num' in ruby/dl

Discussion in 'Ruby' started by bbmerong, Jan 17, 2008.

  1. bbmerong

    bbmerong Guest

    I have a question about "ruby/dl".

    I define the function in "ruby/dl" like the belows

    --------------------------------------
    require 'dl'
    LIB=DL.dlopen('libfunc.dll')
    cfunc=LIB['cfunc','ISi'] # int cfunc(char *data,int *num)
    ---------------------------------------

    After typing in irb, I typed them like this.

    len=DL.malloc(DL.sizeof("I"))
    err=cfunc.call("hello",len)


    But, error message is displayed like the belows.

    "TypeError: can't convert DL::ptrData into Integer"

    I'm not sure how to solve the problem.

    Please let me know the reason and solutions for novice like me.

    Then, Thank you in advance.
     
    bbmerong, Jan 17, 2008
    #1
    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. Francis Bell

    get(char*, num, delim) question

    Francis Bell, May 22, 2004, in forum: C++
    Replies:
    12
    Views:
    1,339
    Francis Bell
    May 24, 2004
  2. Alex Vinokur
    Replies:
    1
    Views:
    4,053
    Alex Vinokur
    Feb 12, 2005
  3. bbmerong
    Replies:
    0
    Views:
    164
    bbmerong
    Jan 18, 2008
  4. bbmerong
    Replies:
    2
    Views:
    155
    Ken Bloom
    Jan 18, 2008
  5. lian ravago

    How to get the num of days absent using c#

    lian ravago, Dec 1, 2003, in forum: Javascript
    Replies:
    2
    Views:
    118
    GIMME
    Dec 1, 2003
Loading...

Share This Page