extensions on Windows

S

Steven Jenkins

I could use some help from someone who knows Windows.

We use a commercial system engineering tool here at work. It has a C API
that I've wrapped with SWIG and successfully made into an extension on
Linux. The vendor's Linux library is static, but building it into the
Ruby interpreter is straightforward. It works well.

Some of my colleagues would like to use this extension on Windows. I run
Cygwin with Ruby on my Windows machine, but the vendor's DLL was built
with a Microsoft compiler. I played around for a couple of hours with
trying to get gcc to link against a MS DLL and got nowhere, so I
installed the One-Click Ruby for Windows and downloaded MS Visual C++
Toolkit 2003. After another couple of hours, it seemed I needed to also
install something called the Platform SDK. OK, did that, but now it
fails to find MSVCRT.lib when linking.

What am I missing? Is there some simple way to set up an environment
that can compile a single .c file, link against a DLL, and make a shared
object for Ruby?

Any help appreciated.

Steve
 
P

Peter Wood

Steve,

I ran into this one as well while using the free compilation tools
from Microsoft. I believe you also have to install the .Net SDK to
get the MSVCRT.lib. Hope that helps.

Peter
 
R

Robert Klemme

Peter Wood said:
Steve,

I ran into this one as well while using the free compilation tools
from Microsoft. I believe you also have to install the .Net SDK to
get the MSVCRT.lib. Hope that helps.

I'm not 100% sure but I think I remember that this lib is part of the OS.
Did you check whether you have that file or MSVCRT.DLL on your machine?

Kind regards

robert
 
S

Steven Jenkins

Robert said:
I'm not 100% sure but I think I remember that this lib is part of the OS.
Did you check whether you have that file or MSVCRT.DLL on your machine?

I have 17 copies of the .dll, but none of the .lib.

The error I get is

LINK : fatal error LNK1104: cannot open file "MSVCRT.LIB'

Can I link against the DLL?

Steve
 
R

Robert Klemme

Steven Jenkins said:
machine?

I have 17 copies of the .dll, but none of the .lib.

The error I get is

LINK : fatal error LNK1104: cannot open file "MSVCRT.LIB'

Can I link against the DLL?

<disclaimer windowsguru="false">I think so.</disclaimer>

robert
 
P

Peter Wood

Steven Jenkins said:
<disclaimer windowsguru="false">I think so.</disclaimer>

robert

I gave up trying trying to get my extension to compile against a DLL.
If you install the .NET SDK to the default location the msvcrt.lib
file should be in a subdirectory below c:\Program Files\Microsoft
Visual Studio .NET 2003\Vc (probably lib). I know its a pain and a
waste of disk space (if that concerns you) but it worked for me.

Peter
 
S

Steven Jenkins

Peter said:
I ran into this one as well while using the free compilation tools from
Microsoft. I believe you also have to install the .Net SDK to get the
MSVCRT.lib. Hope that helps.

This is why I feel I don't speak the language of the country I'm in. I
installed Microsoft Visual C++ Toolkit 2003, which presumably would
include the (M)icros(S)oft (V)isual (C) (R)un(T)ime library, but
doesn't. Of course not--it's in the .NET SDK!

But hey, I'll try it. Thanks for the tip.

Steve
 
S

Saynatkari

Steven said:
I have 17 copies of the .dll, but none of the .lib.

The error I get is

LINK : fatal error LNK1104: cannot open file "MSVCRT.LIB'

Can I link against the DLL?

It is theoretically possible to unwind a DLL into a LIB (you need
to mess with the config) but I was never successful with these
particular files. I would send you mine but I got rid of Windows.

Just download the .Net SDK and throw everything else away :)

E
 
S

Steven Jenkins

Saynatkari said:
It is theoretically possible to unwind a DLL into a LIB (you need
to mess with the config) but I was never successful with these
particular files. I would send you mine but I got rid of Windows.

Just download the .Net SDK and throw everything else away :)

I'm trying. Unfortunately, the MS download site (or my path to it) is
SSSSLLLLOOOOWWWW. The longer it runs, the greater the estimated time
left. Must be using tachyons or something.

Steve
 
R

Robert Klemme

Steven Jenkins said:
I'm trying. Unfortunately, the MS download site (or my path to it) is
SSSSLLLLOOOOWWWW. The longer it runs, the greater the estimated time
left. Must be using tachyons or something.

Turning your clock around usually fixes such time problems... :)

robert
 
S

Steven Jenkins

Peter said:
I gave up trying trying to get my extension to compile against a DLL. If
you install the .NET SDK to the default location the msvcrt.lib file
should be in a subdirectory below c:\Program Files\Microsoft Visual
Studio .NET 2003\Vc (probably lib). I know its a pain and a waste of
disk space (if that concerns you) but it worked for me.

I did, and it's right there. Thanks.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,170
Latest member
Andrew1609
Top