Hello,
I created a very small C library for Ruby. It compilies and works great on Windows 2000 using cygwin. On Windows XP, however, I get the following run-time error:
Exception LoadError' at /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4 - dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4:in
require’: dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so (LoadError)
from /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4
from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101:in require' from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101 from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279:in
require’
from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279
from tst/tst_locana.rb:15:in `require’
from tst/tst_locana.rb:15
Has anyone seen this error before and/or have any suggestions on how to work around it? I an running the latest cygwin on XP. The gcc compiler is gcc version 3.2 20020927 (prerelease).
Any suggestions on how to work around this issue is greatly appreciated.
Thanks,
Michael Davis
PS, here is the content of a few important files incase it helps:
contents of locana_gui_mswin32_ext.def:
EXPORTS
Init_locana_gui_mswin32_ext
contents of extconf.rb:
require 'mkmf'
case RUBY_PLATFORM
when /cygwin/,/mingw/
$CFLAGS = "-fno-defer-pop -fno-omit-frame-pointer"
create_makefile("locana_gui_mswin32_ext")
when /win32/
create_makefile("locana_gui_mswin32_ext")
end
first few lines of locana_gui_mswin32_ext.c:
#if !defined _MSC_VER && !defined NT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#endif
#include "ruby.h"
#include "rubysig.h"
Michael Davis mdavis@sevasoftware.com writes:
I created a very small C library for Ruby. It compilies and works great on Windows 2000 using cygwin. On Windows XP, however, I get the following run-time error:
Exception LoadError' at /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4 - dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4:in
require’: dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so (LoadError)
from /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4
from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101:in require' from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101 from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279:in
require’
from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279
from tst/tst_locana.rb:15:in `require’
from tst/tst_locana.rb:15
Has anyone seen this error before and/or have any suggestions on how to work around it? I an running the latest cygwin on XP. The gcc compiler is gcc version 3.2 20020927 (prerelease).
Any suggestions on how to work around this issue is greatly appreciated.
Check the permission of the so file:
$ ls -l /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so
It needs execute permission.
···
–
eban
This was a great suggestion but the permissions were alreay set properly. I successfully worked around this issue by running make install and eliminated moving the binary to a locana sub-directory. However, now I am faced with another issue where calling simple Win32API functions such as CreateWindow are failing. Any other suggestions?
WATANABE Hirofumi wrote:
···
Michael Davis mdavis@sevasoftware.com writes:
I created a very small C library for Ruby. It compilies and works great on Windows 2000 using cygwin. On Windows XP, however, I get the following run-time error:
Exception LoadError' at /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4 - dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4:in
require’: dlopen: Win32 error 5 - /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so (LoadError)
from /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32.rb:4
from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101:in require' from /usr/local/lib/ruby/site_ruby/1.6/locana/locana_bindings.rb:101 from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279:in
require’
from /usr/local/lib/ruby/site_ruby/1.6/locana.rb:279
from tst/tst_locana.rb:15:in `require’
from tst/tst_locana.rb:15
Has anyone seen this error before and/or have any suggestions on how to work around it? I an running the latest cygwin on XP. The gcc compiler is gcc version 3.2 20020927 (prerelease).
Any suggestions on how to work around this issue is greatly appreciated.
Check the permission of the so file:
$ ls -l /usr/local/lib/ruby/site_ruby/1.6/locana_gui_mswin32_ext.so
It needs execute permission.