From: Bernhard Brodowsky Date: 2012-08-30T03:08:49+09:00 Subject: Common Traps for C extensions Hi, I am writing a toy library in C++ and currently, I am writing a Ruby extensions for it. I have one C++ layer to catch all the C++ exceptions, convert them into error codes wich casts the void Pointers it gets from C to the appropriate classes etc. Then I have one C layer which handles the Ruby datatypes and raises the correct exceptions. But now I am thinking of possible traps I might run into. For example, the Ruby interpreter forces me to differentiate between allocation and initialization and in my current implementation, the User could redefine the initialize() method of my class and then call another method, which results in undefined behaviour or possibly segfault. I can easily solve that problem (e.g. by setting some internal flag) but there are probably a thousand other typical traps like that, where the dynamicity of Ruby messes with my C memory management. Do you know any important others? -- Posted via http://www.ruby-forum.com/.