From: Roger Pack Date: 2009-10-03T01:42:22+09:00 Subject: [ruby-core:25907] Re: link to msvcrt.dll by using VC9 > To the mswin version freaks, > > I'm happy to report that I've succeeded to build ruby linked > to msvcrt.dll by using VC9. > Thes means that now we are librated from the runtime hell. Glad to hear that this is possible. > Requirement: > * of course, VC9 (VS2008, all edition) > * WDK (Windows Driver Kit; you can download it from Microsoft's > site) Wonder why it needs the device driver kit... > * ruby trunk HEAD When I compile HEAD currently with mingw I get gcc -O3 -fomit-frame-pointer -g -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -L. -Wl,--stack,0x00200000,--enable-auto-import main.o dmydln.o dmyencoding.o miniprelude.o array.o bignum.o class.o compar.o complex.o dir.o enum.o enumerator.o error.o eval.o load.o proc.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strftime.o string.o struct.o time.o transcode.o util.o variable.o version.o compile.o debug.o iseq.o vm.o vm_dump.o thread.o cont.o ascii.o us_ascii.o unicode.o utf_8.o newline.o langinfo.o fileblocks.o crypt.o lgamma_r.o strlcpy.o strlcat.o win32.o dmyext.o -lshell32 -lws2_32 -o miniruby.exe c:\dev\ruby\downloads\ruby_trunk\miniruby.exe: [BUG] Segmentation fault ruby 1.9.2dev (2009-10-03 trunk 25103) [i386-mingw32] -- control frame ---------- c:0001 p:0000 s:0002 b:0002 l:0000e4 d:0000e4 TOP --------------------------- ... make: *** [.rbconfig.time] Error 3 So...making sure we're all on the same page... I believe the problem from previous discussion was that if you compile using one version of msvcrt.dll, then use a binary extension compiled using another, errno changes, long double's don't work (in the case of mingw versus vc), and extension developers must use xfree instead of free and rb_f_sprintf/rb_vsprintf/rb_io_printf instead of printf/sprintf [1]. Does that sound right (I've never tried it so I'm not certain)? Thanks. -r [1]http://programming-gone-awry.blogspot.com/2009/07/how-to-compile-using-visual-studio-for.html (and of course you can't compile statically against the version of msvcrt).