From: "Matěj P." Date: 2012-01-19T07:23:37+09:00 Subject: Extending/embedding Ruby Hi! I would like to extend nfdump in Ruby, which will be probably challenge for me, because I have never write any extension. What is core thing is, that nfdump reads binary file with huge amount of data. This reading and all other job I want to do nfdump which is in C and dont have library files, so I cant use ffi or something like that. Nfdump reads file header, makes a structure represents a netflow file and than it reads n flow records which is represented by struct in which is another struct and variables. I need to get this structure to Ruby. My first question is, if its possible to get struct in which is other struct etc. to Ruby. Second is about approach. I have some problems with embedding Ruby Interpreter in C- example from Programming in Ruby fails on SegFault. So do you thing it is possible to write this as Ruby extension? In the case of Ruby extension I didnt see in any example how to get to Ruby struct which is inicialized in C. I cant inicialize it in Ruby because its a lot of data and I dont know how many flows are in file. I cant give structs to array because of memory problem and also I need to work with record as soon as its read from the file by C. Your suggestion are highly welcomed. Thanks in advance. -- Posted via http://www.ruby-forum.com/.