Compiling C extensions with MSVC

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.

···

---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click.

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.

Hi,

At Fri, 4 Nov 2005 12:39:07 +0900,
Eric Hofreiter wrote in [ruby-talk:164084]:

c_lib-i386-mswin32.def : error LNK2001: unresolved external symbol Init_c_lib

It is the function what *you* have to write to initialize the
extension.

···

--
Nobu Nakada

Off topic but the koontzfamily doesnt include the famous author Dean does it?

I can think of some mean programmer as protagonist based horror stories :slight_smile:

···

On 11/4/05, David Koontz <david@koontzfamily.org> wrote:

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

Continuing this OT thread, I am currently "reading" (actually, I
listen to audiobooks as I commute) Snow Crash by Neal Stephenson. It
is a very, very good and the protagonist is a hacker named "Hiro
Protagonist". Its sci-fi, not horror, but its one of the best books
I've read in a while.

Curt

···

On 11/4/05, Lyndon Samson <lyndon.samson@gmail.com> wrote:

On 11/4/05, David Koontz <david@koontzfamily.org> wrote:
> 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
>

Off topic but the koontzfamily doesnt include the famous author Dean does it?

I can think of some mean programmer as protagonist based horror stories :slight_smile:

> > 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
> >
>
> Off topic but the koontzfamily doesnt include the famous author Dean
does it?
>
> I can think of some mean programmer as protagonist based horror stories
:slight_smile:

Continuing this OT thread, I am currently "reading" (actually, I
listen to audiobooks as I commute) Snow Crash by Neal Stephenson. It
is a very, very good and the protagonist is a hacker named "Hiro
Protagonist". Its sci-fi, not horror, but its one of the best books
I've read in a while.

And for one last addition to the OT'ness. If you like Snow Crash make sure
to check out a couple of his other books, especially Diamond Age and
Cryptonomicon.

Curt

···

On 11/4/05, Curt Hibbs <curt.hibbs@gmail.com> wrote:

On 11/4/05, Lyndon Samson <lyndon.samson@gmail.com> wrote:
> On 11/4/05, David Koontz <david@koontzfamily.org> wrote:

--
===Tanner Burson===
tanner.burson@gmail.com
http://tannerburson.com <---Might even work one day...