Jeff Mitchell wrote:
···
Immediately after mailing y'all, I realized I should have given a
minimal case rather than even mentioning my package.Here we go. With the below extension,
-- my mingw32-ruby, extension compiled with mingw32-ruby
--> success
-- my mingw32-ruby, extension compiled with mswin32-ruby
--> success
-- my mswin32-ruby, extension compiled with mingw32-ruby
--> success
-- my mswin32-ruby, extension compiled with mswin32-ruby
--> success-- one-click mswin32-ruby, extension compiled with mingw32-ruby
--> SEGFAULT
-- one-click mswin32-ruby, extension compiled with mswin32-ruby
--> SEGFAULT-----------------------------------
# extconf.rb:
require 'mkmf'
create_makefile("myclass")-----------------------------------
# test.rb
require './myclass.so'
loop { MyClass.new }-----------------------------------
// myclass.c#include "ruby.h"
struct MyStruct_
{
int n ;
} ;typedef struct MyStruct_ MyStruct ;
void myclass_free(MyStruct* data)
{
free(data) ;
}VALUE rb_myclass_initialize( VALUE self )
{
MyStruct *data;
Data_Get_Struct(self, MyStruct, data);
return Qnil ;
}static VALUE rb_myclass_s_allocate(VALUE klass)
{
MyStruct* data ;
VALUE obj = Data_Make_Struct(klass,
MyStruct,
0,
myclass_free,
data) ;
return obj ;
}VALUE cMyClass ;
void Init_myclass()
{
cMyClass = rb_define_class("MyClass", rb_cObject) ;
rb_define_alloc_func(cMyClass, rb_myclass_s_allocate) ;
rb_define_method(cMyClass, "initialize", rb_myclass_initialize, 0) ;
}
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004