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

**URL:** <https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418>\
**Category:** Ruby\
**Created:** [January 18, 2008, 4:21am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418 "2008-01-18T04:21:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbmerong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ce7236/32.png) [@bbmerong](https://www.ruby-forum.com/u/bbmerong)\
**Post date:** [January 18, 2008, 4:21am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418/1 "2008-01-18T04:21:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bbmerong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ce7236/32.png) [@bbmerong](https://www.ruby-forum.com/u/bbmerong)\
**Post date:** [January 18, 2008, 4:24am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418/2 "2008-01-18T04:24:36Z")

</div>

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

Jason

---

<div class="post-metadata">

**Author:** ![bbmerong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ce7236/32.png) [@bbmerong](https://www.ruby-forum.com/u/bbmerong)\
**Post date:** [January 18, 2008, 4:46am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418/3 "2008-01-18T04:46:15Z")

</div>

Quoth Jason R.:

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

Or develop some patience.

---

<div class="post-metadata">

**Author:** ![bbmerong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ce7236/32.png) [@bbmerong](https://www.ruby-forum.com/u/bbmerong)\
**Post date:** [January 18, 2008, 5:41am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418/4 "2008-01-18T05:41:11Z")

</div>

On Thu, 17 Jan 2008 22:23:52 -0500, Jason R. wrote:

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

---

<div class="post-metadata">

**Author:** ![bbmerong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ce7236/32.png) [@bbmerong](https://www.ruby-forum.com/u/bbmerong)\
**Post date:** [January 18, 2008, 6:09am UTC](https://www.ruby-forum.com/t/from-int-cfunc-char-data-int-num-how-can-i-get-the-value-of-num-in-ruby-dl/126418/5 "2008-01-18T06:09:16Z")

</div>

Quoth Ken B.:

> emails he sent for over a week.)
> 
> –  
> Ken (Chanoch) Bloom. PhD candidate. Linguistic Cognition Laboratory.  
> Department of Computer Science. Illinois Institute of Technology.  
> [http://www.iit.edu/~kbloom1/](http://www.iit.edu/~kbloom1/)

He’s posted the same message about four times now, with various  
differing time  
intervals between them. This would lead me to believe that he is just  
posting  
repeatedly on rubyforum.

Regards,
