From: daz Date: 2004-05-08T06:58:55+09:00 Subject: Re: miniruby.exe & statically linked ruby.exe (Windows) Phil Tomson wrote: > > Well, there's a Win32API.so in ext/Win32API and I explicitly specified the > whole path to it and got a crash (illegal instruction or somesuch) so I'm > sure I got the right .so file. > > >Time to try the ext\Setup method of static linking libraries? > > > > Maybe, it seems I tried it though, and didn't see the binary get any > larger which is what I would have expected. On Linux I believe you have > to edit ext/Setup and then re-run configure, but the Windows configure.bat > doesn't seem to do much... > > Phil On Windows, the magic seems to occur in ext\extmk.rb which tries to create and run makefiles for each of the extensions in the ext directory. It looks at ext\Setup for any "static" requests and proceeds as follows for any that it finds: 1) creates a .lib file for eventual merger into xxx-ruby18-static.lib 2) adds its name to a generated "C" file called extinit.c which would be called by ruby.exe to "automatically require" static exts. This is what would be done manually but most cleverly automated, IMO. Yes, you could have a static ruby.exe (900+Kb) and a static Win32API (900+Kb) etc., but really you only want the functions from xxx-ruby18-static.lib included once in the final .exe and that's what the build process attempts to do. I'm not seriously determined to get this to work, so I haven't checked my procedures carefully but, ATM, I have a statically linked Ruby + Win32API + stringio + socket (Total size 900+Kb) which fails to "auto-require". Grepping ruby.c for "Init_ext()" and "require_libraries()" finds comments which suggest that this area may be not quite complete. I'd estimate that it's not far off target, though. daz