Ask a Question related to Ruby, Design and Development.
-
Andy Pelzer #1
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
-
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... -
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... -
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... -
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. ... -
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... -
Michael Davis #2
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
-
Andy Pelzer #3
Re: Ruby Extension/DLL Help
Hi,
DLL in c:\winnt\systems (or c:\windows>> In the end, I had to create the DLL using MS Visual C++ and put theSince i don't have MSVC i couldn't test it your way. So i tried with>> \system).
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??
issue is with cygwin or XP.>> I think there is an issue with cygwin on XP. I am not sure if the
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!).
in the library.>> Once this was done, I used win32api to successfully access functions
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
-
Michael Davis #4
Re: Ruby Extension/DLL Help
See comments below...
Andy Pelzer wrote:
Bummer.> 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??
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.>
>>>>>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!).
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.>
>>>>>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?
See comments above...>
> Anyways, thanks again, i'll keep on trying [ though not much time for it
> ;( ]
>
> Greets
>
> Andy
>
>
>
>
Thanks, Michael
Michael Davis Guest
-
Andy Pelzer #5
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



Reply With Quote

