# 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/126320>\
**Category:** Ruby\
**Created:** [January 17, 2008, 12:46pm 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/126320 "2008-01-17T12:46:34Z")\
**Posts on this page:** 1\
**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 17, 2008, 12:46pm 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/126320/1 "2008-01-17T12:46:34Z")

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

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

Then, Thank you in advance.
