From: Steven Jenkins Date: 2005-04-13T15:52:45+09:00 Subject: Re: extensions on Windows Steven Jenkins wrote: > I'll give the .NET SDK download another hour or so :-(. As long as I'm > here to keep restarting it after the connection resets, it'll finish > eventually. That turned out to be a bad wireless card, it seems. After much setting of environment variables, or whatever Windows calls things like %LIB% and %INCLUDE%, I can build the .so file. Here's what 'ruby setup.rb setup' shows me: ---> bin <--- bin ---> lib ---> lib/jpl <--- lib/jpl <--- lib ---> ext ---> ext/jpl ---> ext/jpl/cradle nmake Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -IC:/cygwin/home/sjenkins/ruby-cradle/ext/jpl/cradle -I. -I./.. -I./../missing -c -Tccradleapi.c cradleapi.c c:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_cradle'" > cradle-i386-mswin32.def cl -nologo -LD -Fecradle.so cradleapi.obj msvcrt-ruby18.lib cradleapi.lib oldnames.lib user32.lib advapi32.lib wsock32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:"c:/ruby/lib" -def:cradle-i386-mswin32.def Creating library cradle.lib and object cradle.exp <--- ext/jpl/cradle <--- ext/jpl <--- ext That looks right, I guess. I'm compiling a SWIG wrapper called cradleapi.c, linking it with the vendor library cradleapi.lib, and making a shared object called cradle.so. 'ruby setup.rb install' looks reasonable: ---> bin mkdir -p c:/ruby/bin/ install cradle_demo c:/ruby/bin/ <--- bin ---> lib mkdir -p c:/ruby/lib/ruby/site_ruby/1.8/ ---> lib/jpl mkdir -p c:/ruby/lib/ruby/site_ruby/1.8/jpl install cradle.rb c:/ruby/lib/ruby/site_ruby/1.8/jpl <--- lib/jpl <--- lib ---> ext ---> ext/jpl ---> ext/jpl/cradle mkdir -p c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/jpl install cradle.so c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/jpl <--- ext/jpl/cradle <--- ext/jpl <--- ext When I try to load the extension, however, I get a "Bad Image" dialog box that says "The application or DLL [....]\jpl\cradle.so is not a valid Windows image. Please checdk this against your installation diskette." I've checked obvious things like permissions, etc. As far as I can tell, cradle.so is opaque. I have no idea how to tell what's wrong with it. Any suggestions? Steve