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

B

bbmerong

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.

It makes me annoying


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


Then, Thank you in advance.
 
J

Jason Roelofs

[Note: parts of this message were removed to make it a legal post.]

Stop posting the same thing. If you don't get an answer, maybe you need to
restate your question.

Jason
 
K

Ken Bloom

Stop posting the same thing. If you don't get an answer, maybe you need
to restate your question.

Calm down. The same message, posted two minutes apart, probably means a
mail server hiccuped somewhere along the line, and probably doesn't mean
the poster had any intention to be rude or pushy.

--Ken
(Who finally got his mail unstuck yesterday after nobody recieved the
emails he sent for over a week.)
 

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

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top