Newbie question : Extending Ruby

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Newbie question : Extending Ruby

    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.
    DaZoner Guest

  2. Similar Questions and Discussions

    1. newbie question for Ruby and/or PHP
      Hi, with some of your help, I manage to extract a delimited record into mysql database using ruby. I have the following structure in my MySQL...
    2. Extending Ruby : segment violation
      I'm making my first extension to Ruby. The C file declarations look like: __declspec(dllexport) VALUE cImage8 = Qnil; __declspec(dllexport)...
    3. Ruby OO-newbie design-question
      Hi! I'm not at all new to programming, I know OO-concepts but I don't have any hands-on experience with designing/programming OO except for small...
    4. [ruby-talk] newbie locale/ascii sort question
      Hi, In message " Re: newbie locale/ascii sort question" on 03/07/01, Bengt Dahlqvist <bengt.dahlqvist@ling.uu.se> writes: |Does such utilities...
    5. [WIN] Compiling / Extending ruby using Visual Studio IDE
      "Shashank Date" <sdate@everestkc.net> writes: I have, and was too succesfull with lcc-win32. I strongly suggest you check out how extconf.rb...
  3. #2

    Default Re: Newbie question : Extending Ruby

    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.

    Lyle Johnson Guest

  4. #3

    Default Re: Newbie question : Extending Ruby

    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
    Aleksei Guzev Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139