开发者

How to declare argc, argv in ruby ffi, and how to pass proper values to it?

Answered: What is proper ruby ffi code for this 开发者_Python百科function:

void glutInit(int *argc, char ** argv);

attach_function :glutInit, [:pointer, :pointer], :void

Answered: How to handle array of C-strings? Like a pointer!

Still unanswered:How to change ARGV to match argument type?

If you know how to get "untouched" C argc and argv in Ruby script it would also helped (eg. python have special library for that, I'm not aware of anything similar for Ruby apart from ARGV).


here someone has written about this: http://zegoggl.es/2009/05/ruby-ffi-recipes.html

you can use :varargs in your attach_function call, and when you call gluInit, you pass an array of type/value pairs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜