extension problem with the one-click installer

J

Jeff Mitchell

Could someone confirm the following segfault for the one-click Windows
installer (ruby181-13.exe). It occurs for the extension compiled with
mingw32-gcc and with VC++ 6.0 SP5.

There is no problem for a homebuilt ruby from the 1.8.1 standard
tarball with either mingw32-gcc or VC++.
ruby test.rb
test.rb:2: [BUG] Segmentation fault
ruby 1.8.1 (2003-12-25) [i386-mswin32]

-----------------------------------
# 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 )
{
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 Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
 
J

Jeff Mitchell

To the one-click installer team (or anyone else), have you

(1) Confirmed the bug by compiling the extension with VC++ 6.0 SP5?
(2) ditto with mingw32?
(3) what happened when you compiled the extension with VS.NET?
(4) Try (1)-(3) using ruby compiled with VS.NET without runtime 7.1

Without a VS.NET compiler, I can only confirm (1) and (2), and that
the bug is not present when the interpreter is built with mingw32 or
with VC++ 6.0.

But whether or not this bug is related to the 7.1 runtime (it probably
is), using a different runtime can't be a good thing. Ruby-win32 has
deliberately chosen the msvcrt.dll runtime -- both the VC++ and
mingw32 builds use it -- in order to make extensions compatible. But
the one-click installer is not using it, and (surprise) extensions are
not compatible.

Could you just use msvcrt.dll, please? If you must use VS.NET, it can
be configured to create executables which do not depend on msvcrt71.dll.

Jeff

---original message---

Could someone confirm the following segfault for the one-click Windows
installer (ruby181-13.exe). It occurs for the extension compiled with
mingw32-gcc and with VC++ 6.0 SP5.

There is no problem for a homebuilt ruby from the 1.8.1 standard
tarball with either mingw32-gcc or VC++.
ruby test.rb
test.rb:2: [BUG] Segmentation fault
ruby 1.8.1 (2003-12-25) [i386-mswin32]

-----------------------------------
# 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 )
{
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) ;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top