Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Compiling C extensions with MSVC

Reply
Thread Tools

Compiling C extensions with MSVC

 
 
Eric Hofreiter
Guest
Posts: n/a
 
      11-04-2005
--0-296179830-1131075544=:95187
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

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 ex=
tconf.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 f=
ind header files and libraries. So I went into the makefile and manually=
changed things so that it would include everything that it asked for. H=
owever, 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 '0=
x2'
Stop.
=20
"c_lib" is the name of the extension and .c file. I believe this may hav=
e 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 directori=
es were the only one that had msvcrt.lib.

=09
---------------------------------
Yahoo! FareChase - Search multiple travel sites in one click. =20
--0-296179830-1131075544=:95187--


 
Reply With Quote
 
 
 
 
David Koontz
Guest
Posts: n/a
 
      11-04-2005
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.
>
>
>
>





 
Reply With Quote
 
 
 
 
Lyndon Samson
Guest
Posts: n/a
 
      11-04-2005
On 11/4/05, David Koontz <> 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=3D230
>


Off topic but the koontzfamily doesnt include the famous author Dean does i=
t?

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


 
Reply With Quote
 
Curt Hibbs
Guest
Posts: n/a
 
      11-04-2005
On 11/4/05, Lyndon Samson <> wrote:
> On 11/4/05, David Koontz <> 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=3D230
> >

>
> 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 :=

-)

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


 
Reply With Quote
 
Tanner Burson
Guest
Posts: n/a
 
      11-04-2005
------=_Part_34939_3658069.1131117088283
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On 11/4/05, Curt Hibbs <> wrote:
>
> On 11/4/05, Lyndon Samson <> wrote:
> > On 11/4/05, David Koontz <> 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=3D230
> > >

> >
> > 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

>
>
> 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
>
>



--
=3D=3D=3DTanner Burson=3D=3D=3D

http://tannerburson.com <---Might even work one day...

------=_Part_34939_3658069.1131117088283--


 
Reply With Quote
 
nobu.nokada@softhome.net
Guest
Posts: n/a
 
      11-05-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling Ruby with MSVC Sergey Haritonov Ruby 0 01-17-2009 06:43 AM
Problem in compiling a C code with MSVC++6.00 Babak C Programming 23 06-27-2006 07:22 AM
Problems compiling Ruby extension in MSVC Sriyansa Ruby 1 01-25-2006 03:48 AM
Unable to access extensions menu or add extensions (I've tried past suggestions) nospam@spam.com Firefox 8 12-01-2005 01:33 AM
Problem Compiling Xerces-C 2.3 with MSVC.Net 7.1 Dan XML 0 07-01-2003 11:57 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57