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

I have a question about “ruby/dl”.

I define the function in “ruby/dl” like the belows

require ‘dl’
cfunc=LIB[‘cfunc’,‘ISi’] # int cfunc(char *data,int *num)

After typing in irb, I typed them like this.


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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs