小松です。

In the message of [ruby-dev:9111] Re: xmalloc() in Windows 
    on 2000/2/4 22:29:43 Katsuyuki Komatsu <komatsu / sarion.co.jp> wrote:
>でも、こうやってC Runtimeに入っているものを入れていくときりがないか。
>そろそろ、MSVCRT.DLL化かRubyCRT.dllの導入を考えないと。

RubyCRT.dllを作り、それを使ってRubyも作ってみました。
Rubyにいくつか変更が必要でしたが、そちらのパッチは後ほど。

ところで、RubyCRT.dllは配布できるんでしょうかね?
PerlCRT.dllがCPANに登録されているのを見ると、大丈夫そうですが。

以下は、RubyCRT.dllの作成手順です。
パスは適当に読み替えてください。

1.  C:\Program Files\Microsoft Visual Studio\VC98\CRT\SRCを
    適当な場所、たとえばC:\lang\RubyCRTにコピーします。

2.  サンプルの.DEF等を実際に使用するファイルにコピー(あるいは移動)
    します。

    cd C:\lang\RubyCRT
    copy ext_mkf Makefile
    copy ext_mkf.inc Makefile.inc
    copy ext_mkf.sub Makefile.sub
    copy _SAMPLE_.RC RubyCRT.RC
    copy SAMPLE_I.RC MSVCIRT.RC
    copy SAMPLE_P.RC MSVCP60.RC
    copy SAMPLE_I.DEF MSVCIRT.DEF
    copy SAMPLD_I.DEF MSVCIRTD.DEF
    copy SAMPLE_P.DEF MSVCP60.DEF
    copy SAMPLD_P.DEF MSVCP60D.DEF
    copy Intel\_SAMPLE_.DEF Intel\RubyCRT.DEF
    copy Intel\_SAMPLD_.DEF Intel\RubyCRTD.DEF

3.  添付のパッチを適用して以下をエクスポートし、内部名を変更します。
    Makefileの変更はディレクトリ名のスペースの対応です。

      _alloc_osfhnd
      _free_osfhnd
      __pioinfo
      _set_osfhnd

4.  以下を実行します。バイナリは、build/intelの下に作成されます。

    set V6TOOLS=C:\Program Files\Microsoft Visual Studio\VC98
    make debug && make

5.  あとは、Rubyを-MDスイッチ付で作り直します。

--- Intel/_SAMPLE_.DEF Wed Jun 17 00:00:00 1998 +++ Intel/RubyCRT.DEF Wed Feb 16 14:47:03 2000 @@ -3,6 +3,6 @@ ; This is the .DEF file for the Microsoft Visual C++ Run-Time Library DLL -; The release version is _SAMPLE_.DLL and the debug version _SAMPLD_.DLL. +; The release version is RubyCRT.DLL and the debug version RubyCRTD.DLL. ; ;************************************************************************ -LIBRARY _SAMPLE_ +LIBRARY RubyCRT EXPORTS @@ -15,2 +15,3 @@ EXPORTS acos + _alloc_osfhnd _amsg_exit @@ -125,2 +126,3 @@ EXPORTS free + _free_osfhnd freopen @@ -339,2 +341,3 @@ EXPORTS perror + __pioinfo DATA _pipe @@ -377,2 +380,3 @@ EXPORTS _setmode + _set_osfhnd _set_sbh_threshold --- Intel/_SAMPLD_.DEF Wed Jun 17 00:00:00 1998 +++ Intel/RubyCRTD.DEF Wed Feb 16 14:47:07 2000 @@ -3,6 +3,6 @@ ; This is the .DEF file for the Microsoft Visual C++ Run-Time Library DLL -; The release version is _SAMPLE_.DLL and the debug version _SAMPLD_.DLL. +; The release version is RubyCRT.DLL and the debug version RubyCRTD.DLL. ; ;************************************************************************ -LIBRARY _SAMPLD_ +LIBRARY RubyCRTD EXPORTS @@ -15,2 +15,3 @@ EXPORTS acos + _alloc_osfhnd _amsg_exit @@ -125,2 +126,3 @@ EXPORTS free + _free_osfhnd freopen @@ -339,2 +341,3 @@ EXPORTS perror + __pioinfo DATA _pipe @@ -377,2 +380,3 @@ EXPORTS _setmode + _set_osfhnd _set_sbh_threshold --- SAMPLE_I.DEF Wed Jun 17 00:00:00 1998 +++ MSVCIRT.DEF Wed Feb 16 20:45:02 2000 @@ -3,6 +3,6 @@ ; This is the .DEF file for the Microsoft Visual C++ Old Iostreams Run-Time Library DLL -; The release version is SAMPLE_I.DLL and the debug version SAMPLD_I.DLL. +; The release version is MSVCIRT.DLL and the debug version MSVCIRTD.DLL. ; ;************************************************************************ -LIBRARY SAMPLE_I +LIBRARY MSVCIRT EXPORTS --- SAMPLD_I.DEF Wed Jun 17 00:00:00 1998 +++ MSVCIRTD.DEF Wed Feb 16 20:44:52 2000 @@ -3,6 +3,6 @@ ; This is the .DEF file for the Microsoft Visual C++ Old Iostreams Run-Time Library DLL -; The release version is SAMPLE_I.DLL and the debug version SAMPLD_I.DLL. +; The release version is MSVCIRT.DLL and the debug version MSVCIRTD.DLL. ; ;************************************************************************ -LIBRARY SAMPLD_I +LIBRARY MSVCIRTD EXPORTS --- ext_mkf Wed Jun 17 00:00:00 1998 +++ Makefile Wed Feb 16 19:44:24 2000 @@ -18,14 +18,14 @@ # -RETAIL_DLL_NAME=_sample_ -RETAIL_LIB_NAME=_sample_ -RETAIL_DLLCPP_NAME=sample_p -RETAIL_LIBCPP_NAME=sample_p -RETAIL_DLLIOS_NAME=sample_i -RETAIL_LIBIOS_NAME=sample_i -DEBUG_DLL_NAME=_sampld_ -DEBUG_LIB_NAME=_sampld_ -DEBUG_DLLCPP_NAME=sampld_p -DEBUG_LIBCPP_NAME=sampld_p -DEBUG_DLLIOS_NAME=sampld_i -DEBUG_LIBIOS_NAME=sampld_i +RETAIL_DLL_NAME=RubyCRT +RETAIL_LIB_NAME=RubyCRT +RETAIL_DLLCPP_NAME=MSVCP60 +RETAIL_LIBCPP_NAME=MSVCP60 +RETAIL_DLLIOS_NAME=MSVCIRT +RETAIL_LIBIOS_NAME=MSVCIRT +DEBUG_DLL_NAME=RubyCRTD +DEBUG_LIB_NAME=RubyCRTD +DEBUG_DLLCPP_NAME=MSVCP60D +DEBUG_LIBCPP_NAME=MSVCP60D +DEBUG_DLLIOS_NAME=MSVCIRTD +DEBUG_LIBIOS_NAME=MSVCIRTD # @@ -330,3 +330,3 @@ RC_OPTS=-l 409 -r RC_DEFS=$(COMMON_DEFS) $(WINDOWS_H_DEFS) -RC_INCS=-I$(V6TOOLS)\include +RC_INCS="-I$(V6TOOLS)\include" PDBDIR_CPU = $(RELDIR_CPU) @@ -1727,3 +1727,3 @@ $(RELEASE_DLL) : $(RELDIR_CPU) $(RETAIL_ $(TCMAPLIB_DIR)\tcmap.lib $(TCMAPDLLLIB_DIR)\tcmapdll.lib \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(OBJDIR_DLL)\link.rsp $(OBJDIR_DLL)\implib.rsp @@ -1769,3 +1769,3 @@ $(RELEASE_DLLCPP) : $(RELDIR_CPU) $(RETA $(DLLCPP_STATIC_OBJS) \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(RELEASE_IMPLIB_DLL) \ @@ -1809,3 +1809,3 @@ $(RELEASE_DLLIOS) : $(RELDIR_CPU) $(RETA $(DEFFILE2_DIR)\$(RETAIL_DLLIOS_NAME).def $(IOSSRC_OBJS_DLL:*=dll) \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(RELEASE_IMPLIB_DLL) $(OBJDIR_DLL)\ios_dll.obj \ @@ -1852,3 +1852,3 @@ $(RELEASE_DLL_DBG) : $(RELDIR_CPU) $(RET $(TCMAPLIB_DIR)\tcmap.lib $(TCMAPDLLLIB_DIR)\tcmapdll.lib \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(OBJDIR_DLL_DBG)\link.rsp $(OBJDIR_DLL_DBG)\implib.rsp @@ -1897,3 +1897,3 @@ $(RELEASE_DLLCPP_DBG) : $(RELDIR_CPU) $( $(DLLCPP_STATIC_OBJS_DBG) \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(RELEASE_IMPLIB_DLL_DBG) \ @@ -1940,3 +1940,3 @@ $(RELEASE_DLLIOS_DBG) : $(RELDIR_CPU_DBG $(DEFFILE2_DIR)\$(DEBUG_DLLIOS_NAME).def $(IOSSRC_OBJS_DLL:*=xdll) \ - $(V6TOOLS)\include\winver.h \ + "$(V6TOOLS)\include\winver.h" \ $(RELEASE_IMPLIB_DLL_DBG) $(OBJDIR_DLL_DBG)\ios_dll.obj \ -- 小松克行 / Katsuyuki Komatsu <komatsu / sarion.co.jp>