Extensions on Windows

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

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

···

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

"Peter Wood" <peter@njini.com> schrieb im Newsbeitrag
news:f06210200be8134c79516@[192.168.252.154]...

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

Peter

>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

Peter Wood wrote:

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

Robert Klemme wrote:

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?

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

"Steven Jenkins" <steven.jenkins@ieee.org> schrieb im Newsbeitrag
news:425BDB65.7070307@ieee.org...

Robert Klemme wrote:
>>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?

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

Steven Jenkins wrote:

Robert Klemme wrote:

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?

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

Steve

E

"Steven Jenkins" <steven.jenkins@ieee.org> schrieb im Newsbeitrag
news:425BDB65.7070307@ieee.org...

Robert Klemme wrote:
>>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?

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

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

Saynatkari wrote:

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

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

"Steven Jenkins" <steven.jenkins@ieee.org> schrieb im Newsbeitrag news:425BFA5A.9010600@ieee.org...

Saynatkari wrote:

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

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... :slight_smile:

    robert

Peter Wood wrote:

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