[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Newbie question : Extending Ruby

John Doe

10/13/2003 2:46:00 PM

I'm making my first extension to Ruby. The C file declarations look
like:


__declspec(dllexport) VALUE cImage8 = Qnil;

__declspec(dllexport) void Init_Image8()
{
printf("I get here ...\n");

cImage8 = rb_define_class("Image8",rb_cObject);

printf(" ... but I never get here.\n");

[SNIP: other methods defined ]
}

I get a segmentation fault during the call to rb_define_class(). The
call to Init_Image8() is started by a 'require Image8' statement in my
main Ruby file.

I'm using Microsoft Visual Studio .NET to create my DLL (compiling it as
C) and I'm linking with the mswin32-ruby16.lib without error. Are these
mismatched in some way? Or is there something simple I need to know? I
get the same behavior if I do not export cImage8.

Any help greatly appreciated. At this point I'm stuck.
2 Answers

Lyle Johnson

10/13/2003 4:37:00 PM

0

DaZoner wrote:

> I'm using Microsoft Visual Studio .NET to create my DLL (compiling it as
> C) and I'm linking with the mswin32-ruby16.lib without error. Are these
> mismatched in some way? Or is there something simple I need to know? I
> get the same behavior if I do not export cImage8.

How are you compiling your DLL (i.e. which compiler flags, etc.)?
Generally speaking, you're better off writing an extconf.rb script (as
described in "Programming Ruby" and elsewhere) so that you don't have to
guess which settings to use.

Aleksei Guzev

10/14/2003 4:31:00 AM

0

On Mon, 13 Oct 2003 11:36:55 -0500, Lyle Johnson
<lyle@users.sourceforge.net> wrote:

> DaZoner wrote:
>
>> I'm using Microsoft Visual Studio .NET to create my DLL (compiling it
>> as C) and I'm linking with the mswin32-ruby16.lib without error. Are
>> these mismatched in some way? Or is there something simple I need to
>> know? I get the same behavior if I do not export cImage8.
>
> How are you compiling your DLL (i.e. which compiler flags, etc.)?
> Generally speaking, you're better off writing an extconf.rb script (as
> described in "Programming Ruby" and elsewhere) so that you don't have to
> guess which settings to use.
>


Is there any Visual studio project to build Ruby? Those makefiles are
great, but I like the nevironment becouse of a lot of features.

Aleksei Guzev