Ruby Extension/DLL Help

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Ruby Extension/DLL Help

    Hi,

    Recently i started writing a Ruby extension. This Extension is providing
    access to a dll-library. It has been written in c. Compiling works fine,
    but using it in Ruby always raises this error: "dlsym: win32 error 127
    [..] (LoadError)". What does this error mean? I think it means, that
    Ruby cannot find the dll, used by the extension, but i'm absolutely
    unsure. If this is correct, where does the dll have to be? If not, what
    does this error mean? Any suggestions how to fix this?

    Environment: Ruby 1.8 on WinXp/Cygwin, compiler: gcc/make

    Would be great if anybody could help, i'm absolutely stuck with that.

    Many thanks in advance (and please excuse my bad english)

    Greets

    Andy


    Andy Pelzer Guest

  2. Similar Questions and Discussions

    1. Any Extension for Ruby On Rails on DW
      Hello, I am planning to quit PHP and start developing in Ruby on Rails. Their MVC model is really great and plus MS has also appreciated this...
    2. Ruby - C++ extension
      Hello! I am trying to create a new Ruby extension, which eventually will give to Ruby the functionality of a C++ project. So far, the...
    3. Two problems creating a C++ extension to Ruby
      Hello, I'm having some trouble with my first C++ extension for Ruby. The extension is a wrapper for the id3lib library providing my own interface...
    4. Exception handling in ruby extension
      Quick question, How do you handle exceptions in a ruby extension? I see rb_rescue, but it don't see how I get at the exception object in func2. ...
    5. warning in ruby extension eats memory
      I've written extension in C for ruby and created test case for it. When I've run it ruby eat all memory. I've simplified code as I can and here is...
  3. #2

    Default Re: Ruby Extension/DLL Help

    I think there is an issue with cygwin on XP. I am not sure if the issue is with cygwin or XP. However, libraries built on cygwin using gcc will not load with Ruby on XP, the same code worked great on windows 2000 with cygwin but not on XP. In the end, I had to create the DLL using MS Visual C++ and put the DLL in c:\winnt\systems (or c:\windows\system). Once this was done, I used win32api to successfully access functions in the library.

    Hope this helps, Michael Davis

    Andy Pelzer wrote:
    > Hi,
    >
    > Recently i started writing a Ruby extension. This Extension is providing
    > access to a dll-library. It has been written in c. Compiling works fine,
    > but using it in Ruby always raises this error: "dlsym: win32 error 127
    > [..] (LoadError)". What does this error mean? I think it means, that
    > Ruby cannot find the dll, used by the extension, but i'm absolutely
    > unsure. If this is correct, where does the dll have to be? If not, what
    > does this error mean? Any suggestions how to fix this?
    >
    > Environment: Ruby 1.8 on WinXp/Cygwin, compiler: gcc/make
    >
    > Would be great if anybody could help, i'm absolutely stuck with that.
    >
    > Many thanks in advance (and please excuse my bad english)
    >
    > Greets
    >
    > Andy
    >
    >
    >
    >

    Michael Davis Guest

  4. #3

    Default Re: Ruby Extension/DLL Help

    Hi,
    >> In the end, I had to create the DLL using MS Visual C++ and put the
    DLL in c:\winnt\systems (or c:\windows
    >> \system).
    Since i don't have MSVC i couldn't test it your way. So i tried with
    MinGW (which is delivered with Dev-C++), but couldn't manage to get my
    extension compiled. Have to "investigate" a bit (-> read manual *g*),
    seems MinGW doesn't accept include-paths with -I on command line??
    >> I think there is an issue with cygwin on XP. I am not sure if the
    issue is with cygwin or XP.
    Are you sure about the CygWin<->XP issue? I have another extension (not
    using an additional/external dll), which compiles fine and also works
    with Ruby under CygWin/XP (found an extension-example here:
    [url]http://www.bagley.org/~doug/shootout/compare/binext/ruby/Ackermann[/url] ->
    working!).
    >> Once this was done, I used win32api to successfully access functions
    in the library.
    Why use Win32api to access the dll's functions? I have a dll-library,
    provided by somebody else - no code available to me, so i wrote simple
    "access-functions" in c, as an extension for Ruby. Am i mistaking
    something here?

    Anyways, thanks again, i'll keep on trying [ though not much time for it
    ;( ]

    Greets

    Andy


    Andy Pelzer Guest

  5. #4

    Default Re: Ruby Extension/DLL Help

    See comments below...

    Andy Pelzer wrote:
    > Hi,
    >
    >
    >>>In the end, I had to create the DLL using MS Visual C++ and put the
    >
    > DLL in c:\winnt\systems (or c:\windows
    >
    >>>\system).
    >
    > Since i don't have MSVC i couldn't test it your way. So i tried with
    > MinGW (which is delivered with Dev-C++), but couldn't manage to get my
    > extension compiled. Have to "investigate" a bit (-> read manual *g*),
    > seems MinGW doesn't accept include-paths with -I on command line??
    Bummer.
    >
    >
    >>>I think there is an issue with cygwin on XP. I am not sure if the
    >
    > issue is with cygwin or XP.
    > Are you sure about the CygWin<->XP issue? I have another extension (not
    > using an additional/external dll), which compiles fine and also works
    > with Ruby under CygWin/XP (found an extension-example here:
    > [url]http://www.bagley.org/~doug/shootout/compare/binext/ruby/Ackermann[/url] ->
    > working!).
    No, I am not sure. I bailed on trying to figure out where the error was occurring after a few hours of debugging and opted for a different approach. It could have been a compiler setting or an include path for the libraries.
    >
    >
    >>>Once this was done, I used win32api to successfully access functions
    >
    > in the library.
    > Why use Win32api to access the dll's functions? I have a dll-library,
    > provided by somebody else - no code available to me, so i wrote simple
    > "access-functions" in c, as an extension for Ruby. Am i mistaking
    > something here?
    I used Win32api to eliminate the need to write a C wrapper for the DLL functions I wanted to use. The C wrapper may have performed a little better but would have required a little more work on my part. One of my goals was to eliminate the need to compile any C code.
    >
    > Anyways, thanks again, i'll keep on trying [ though not much time for it
    > ;( ]
    >
    > Greets
    >
    > Andy
    >
    >
    >
    >
    See comments above...

    Thanks, Michael



    Michael Davis Guest

  6. #5

    Default Re: Ruby Extension/DLL Help

    Hi,

    @Tim Sutherland: You guessed right - I can't believe i've been that
    stupid ;(

    Thanks a lot for that - it made my day!

    Bye

    Andy


    Andy Pelzer 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