From: david@... Date: 2005-11-05T07:43:04+09:00 Subject: Re: Fwd: Re: Compiling C extensions with MSVC You are correct that the line: ?-with-ruby-include=C:\Dev\languages\ruby\src\ruby-1.8.3 is meant to be replaced with the path to the ruby source, wherever that may be on your system. As for the error you are getting, since that is a linker error I really don't think the problem is with the ruby source setup. It looks like your compiled c_lib file doesn't have the correct method signature that the linker is looking for. I assume you included an Init_c_lib function in your extension that created your module using rb_define_module? If that's still not fixing it then could you please email me your module's source and I'll give a shot at compiling it or if it's not huge just post it here. David Koontz > Thanks, David, that was a much cleaner way of doing it. However, I > am still getting the exact same error. I believe it has something to > do with the ruby source. You said to include a folder that would > default to Dev\language\ruby\src etc., but no such folder exists on > my system. I'm assuming that this source was what you should use to > build ruby. I did not build ruby myself, I downloaded a pre-built > ruby for windows that has no source in it. So, I downloaded the ruby > source from the website, which made a folder called C:\ruby-1.8.3, > which had several .c files in it. So instead of the Dev\language > thing I just replaced that with C:\ruby-1.8.3. Apparently that was > not the correct thing to do. Otherwise, I did everything else > exactly as you said. Is there something that I'm missing? > > > David Koontz wrote: > Date: Fri, 4 Nov 2005 16:28:50 +0900 > From: David Koontz > Subject: Re: Compiling C extensions with MSVC > To: ruby-talk@ruby-lang.org (ruby-talk ML) > > Hey Eric, I just went through all this myself. I did a write up that > should hopefully guide you through the process. > http://www.koontzfamily.org/david/blog/?p=230 > > HTH, > David Koontz > >> Hello, >> I would very much like to be able to compile a C extension for Ruby >> using MSVC, but I am coming across many problems. First of all, I am >> using extconf.rb with nothing but a create_makefile() statement. >> When it creates the makefile and I try to run it, it complains about >> not being able to find header files and libraries. So I went into >> the makefile and manually changed things so that it would include >> everything that it asked for. However, I am now getting an error >> that says: >> >> c_lib-i386-mswin32.def : error LNK2001: unresolved external symbol >> Init_c_lib >> c_lib.lib : fatal error LNK1120: 1 unresolved externals >> LINK : fatal error LNK1141: failure during build of exports file >> NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x2' >> Stop. >> >> "c_lib" is the name of the extension and .c file. I believe this may >> have something to do with it asking me to link a library called >> msvcrt.lib, which was located in a directed called amd64 or ia64. >> I'm not sure what these two things mean, but I know that they do not >> work with my system. I believe the one that works for me is x86. >> However, those two directories were the only one that had msvcrt.lib.