extension problem with the one-click installer

Discussion in 'Ruby' started by Jeff Mitchell, Jun 18, 2004.

  1. 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
    Jeff Mitchell, Jun 18, 2004
    #1
    1. Advertising

  2. 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---
    Jeff Mitchell <> wrote in message news:<>...

    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) ;
    }
    Jeff Mitchell, Jun 21, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Curt Hibbs
    Replies:
    6
    Views:
    157
  2. Curt Hibbs
    Replies:
    6
    Views:
    133
    Curt Hibbs
    Aug 17, 2004
  3. Replies:
    0
    Views:
    99
  4. Replies:
    2
    Views:
    86
    Curt Hibbs
    Aug 31, 2006
  5. Paul Fraser
    Replies:
    1
    Views:
    110
    Roger Pack
    May 9, 2009
Loading...

Share This Page