# Ruby one-click installer issue with extensions

**URL:** <https://rubytalk.org/t/ruby-one-click-installer-issue-with-extensions/12191>\
**Category:** ruby-talk\
**Created:** [18 June 2004 14:00 UTC](https://rubytalk.org/t/ruby-one-click-installer-issue-with-extensions/12191 "2004-06-18T14:00:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Curt\_Hibbs3](https://avatars.discourse-cdn.com/v4/letter/c/2acd7d/32.png) [@Curt\_Hibbs3](https://rubytalk.org/u/Curt_Hibbs3)\
**Post date:** [18 June 2004 14:00 UTC](https://rubytalk.org/t/ruby-one-click-installer-issue-with-extensions/12191/1 "2004-06-18T14:00:37Z")

</div>

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  
> > &nbsp;&nbsp;&nbsp;--\> success  
> > -- my mingw32-ruby, extension compiled with mswin32-ruby  
> > &nbsp;&nbsp;&nbsp;--\> success  
> > -- my mswin32-ruby, extension compiled with mingw32-ruby  
> > &nbsp;&nbsp;&nbsp;--\> success  
> > -- my mswin32-ruby, extension compiled with mswin32-ruby  
> > &nbsp;&nbsp;&nbsp;--\> success
> > 
> > -- one-click mswin32-ruby, extension compiled with mingw32-ruby  
> > &nbsp;&nbsp;&nbsp;--\> SEGFAULT  
> > -- one-click mswin32-ruby, extension compiled with mswin32-ruby  
> > &nbsp;&nbsp;&nbsp;--\> SEGFAULT
> > 
> > -----------------------------------  
> > # extconf.rb:  
> > require 'mkmf'  
> > create\_makefile("myclass")
> > 
> > -----------------------------------  
> > # test.rb  
> > require './myclass.so'  
> > loop { MyClass.new }
> > 
> > -----------------------------------  
> > // myclass.c
> > 
> > #include "ruby.h"
> > 
> > struct MyStruct\_  
> > {  
> > &nbsp;&nbsp;&nbsp;&nbsp;int n ;  
> > } ;
> > 
> > typedef struct MyStruct\_ MyStruct ;
> > 
> > void myclass\_free(MyStruct\* data)  
> > {  
> > &nbsp;&nbsp;&nbsp;&nbsp;free(data) ;  
> > }
> > 
> > VALUE rb\_myclass\_initialize( VALUE self )  
> > {  
> > &nbsp;&nbsp;&nbsp;&nbsp;MyStruct \*data;  
> > &nbsp;&nbsp;&nbsp;&nbsp;Data\_Get\_Struct(self, MyStruct, data);  
> > &nbsp;&nbsp;&nbsp;&nbsp;return Qnil ;  
> > }
> > 
> > static VALUE rb\_myclass\_s\_allocate(VALUE klass)  
> > {  
> > &nbsp;&nbsp;&nbsp;&nbsp;MyStruct\* data ;  
> > &nbsp;&nbsp;&nbsp;&nbsp;VALUE obj = Data\_Make\_Struct(klass,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyStruct,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myclass\_free,  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data) ;  
> > &nbsp;&nbsp;&nbsp;&nbsp;return obj ;  
> > }
> > 
> > VALUE cMyClass ;
> > 
> > void Init\_myclass()  
> > {  
> > &nbsp;&nbsp;&nbsp;&nbsp;cMyClass = rb\_define\_class("MyClass", rb\_cObject) ;  
> > &nbsp;&nbsp;&nbsp;&nbsp;rb\_define\_alloc\_func(cMyClass, rb\_myclass\_s\_allocate) ;  
> > &nbsp;&nbsp;&nbsp;&nbsp;rb\_define\_method(cMyClass, "initialize", rb\_myclass\_initialize, 0) ;  
> > }  
> > &nbsp;&nbsp;&nbsp;&nbsp;  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Do you Yahoo!?  
> > Yahoo! Mail - Helps protect you from nasty viruses.  
> > [http://promotions.yahoo.com/new\_mail](http://promotions.yahoo.com/new_mail)
> > 
> > ---  
> > Incoming mail is certified Virus Free.  
> > Checked by AVG anti-virus system ([http://www.grisoft.com](http://www.grisoft.com)).  
> > Version: 6.0.699 / Virus Database: 456 - Release Date: 6/4/2004
