Compile with VC++ 6.0, link with older MSVCRT.dll? 
Author Message
 Compile with VC++ 6.0, link with older MSVCRT.dll?


Quote:
> I'm hoping the net might have some hints for how to achieve these
> apparently goals for the products our company is developing:

Have you tried statically linking the CRT?


Sun, 18 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?
I'm hoping the net might have some hints for how to achieve these
apparently goals for the products our company is developing:

1) Develop the products using the most recent Visual C++ available,
currently 6.0 SP3, for support and efficiency reasons (all the new ATL
wizard functionality, COM smart pointer enhancements, the
edit-and-continue debugging, Visual InterDev script debugging
enhancements, etc.)

2) Install those products without requiring a reboot. Our customers
often won't buy if they have to reboot their servers.

These goals seem to be incompatible because components compiled with
VC++ 6.0 require the VC++ 6.0 runtime libraries. MSVCRT.dll CANNOT be
upgraded without a reboot. Here's the list of approaches we've already
eliminated:

1) No, you can't do a no-reboot upgrade of MSVCRT.DLL using the
Windows NT "MoveFileEx()" API. Although all the documentation makes
you think you can do it, MSVCRT.dll is on the KnownDLLs list in the
registry. Search the MSDN for KnownDLLs to find out why they can't be
changed without a reboot.

2) No, you can't just put a copy of MSVCRT.dll in the application
directory or search path. It is a KnownDLL, it ALWAYS loads from the
system directory (effectively).

3) No, you can't just set the AppPath registry entry for your exes to
make it search a different directory first. There is a Knowledge Base
article that explains that there is a bug in the AppPath logic. It
doesn't work for implicitly linked DLLs, only for dynamically loaded
ones (LoadLibrary() or the equivalent COM activations).

4) No, you can't fix it with your PATH environment variable; see (2).

5) No, you can't just link against the older versions of the C runtime
libs (5.0 or 4.1 versions). Even if you avoid any of the new calls in
the 6.0 libraries, the 6.0 headers change the signatures of some
functions, causing link errors when the older libraries are linked.
Try using an fstream object, and you'll see the problem.

6) No, you can't go whole-hog and use the VC5.0 headers and libraries
with the VC6.0 IDE. After the new compiler complains about all the
bugs it is finding in the old headers, it crashes.

So, the bottom-line question: does anyone have a combination that
they've gotten working?  I haven't completely given up on 5 yet, since
it seems there are really very few link problems using the new headers
and old libraries (assuming you avoid the new stuff, again). The
fstream problem might have to do with STRICT being off in VC5.0, and
on in VC6.0, I still have to investigate. Using _ATL_STATIC_REGISTRY
fixes a bunch of problems, too. If someone has a combination of
headers, #defines, and libs  to recommend, I'd be grateful.

Conversely, I'm afraid that if I successfully slog through the compile
problems, I'll just be stuck with an application that compiles but
won't run. If you've been there and know it won't work, please post a
note and I'll stop beating my head against the wall.

Thanks for any and all suggestions. I'll post a summary of anything
useful that turns up.

Rich

rfortier at world.std.com, rfortier at highground.com



Mon, 19 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?

Quote:



>> I'm hoping the net might have some hints for how to achieve these
>> apparently goals for the products our company is developing:

>Have you tried statically linking the CRT?

Sorry, I forgot to put that one on the list.

Yes, we statically linked it. That works, but we have so many pieces
and parts that made the kit 4 times bigger. That option will be the
very last resort.

Rich
---

rfortier at world.std.com, rfortier at highground.com



Mon, 19 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?
Rebuild msvcrt.dll. Call it RichardCRT.DLL and put it in your
application's directory. Tweak your executables and DLLs so
that they link with RichardCRT.DLL.

Done.

Quote:




> >> I'm hoping the net might have some hints for how to achieve these
> >> apparently goals for the products our company is developing:

> >Have you tried statically linking the CRT?

> Sorry, I forgot to put that one on the list.

> Yes, we statically linked it. That works, but we have so many pieces
> and parts that made the kit 4 times bigger. That option will be the
> very last resort.

> Rich
> ---

> rfortier at world.std.com, rfortier at highground.com

--
.Bruce Dawson, Cavedog Entertainment.
Makers of Total Annihilation - http://www.cavedog.com


Mon, 19 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?
That would be nice if we all knew how to rebuild the CRT!  M$ hasn't given a
way to do that as far as I and others know.

-Andy


Quote:
> Rebuild msvcrt.dll. Call it RichardCRT.DLL and put it in your
> application's directory. Tweak your executables and DLLs so
> that they link with RichardCRT.DLL.

> Done.





> > >> I'm hoping the net might have some hints for how to achieve these
> > >> apparently goals for the products our company is developing:

> > >Have you tried statically linking the CRT?

> > Sorry, I forgot to put that one on the list.

> > Yes, we statically linked it. That works, but we have so many pieces
> > and parts that made the kit 4 times bigger. That option will be the
> > very last resort.

> > Rich
> > ---

> > rfortier at world.std.com, rfortier at highground.com

> --
> .Bruce Dawson, Cavedog Entertainment.
> Makers of Total Annihilation - http://www.cavedog.com



Mon, 19 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?
I don't think it is necessary to rebuild the dll, though. Copy
msvcrt.lib and msvcrt.dll to a directory, rename msvcrt.* to
msvcrtprv.*, and link. That should do it, no?

Rich

On Thu, 3 Jun 1999 18:42:09 -0600, "Andrew Osman"

Quote:

>That would be nice if we all knew how to rebuild the CRT!  M$ hasn't given a
>way to do that as far as I and others know.

>-Andy



>> Rebuild msvcrt.dll. Call it RichardCRT.DLL and put it in your
>> application's directory. Tweak your executables and DLLs so
>> that they link with RichardCRT.DLL.

>> Done.





>> > >> I'm hoping the net might have some hints for how to achieve these
>> > >> apparently goals for the products our company is developing:

>> > >Have you tried statically linking the CRT?

>> > Sorry, I forgot to put that one on the list.

>> > Yes, we statically linked it. That works, but we have so many pieces
>> > and parts that made the kit 4 times bigger. That option will be the
>> > very last resort.

>> > Rich
>> > ---

>> > rfortier at world.std.com, rfortier at highground.com

>> --
>> .Bruce Dawson, Cavedog Entertainment.
>> Makers of Total Annihilation - http://www.cavedog.com



Tue, 20 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?

Quote:

> I don't think it is necessary to rebuild the dll, though. Copy
> msvcrt.lib and msvcrt.dll to a directory, rename msvcrt.* to
> msvcrtprv.*, and link. That should do it, no?

> Rich

I doubt that would work because internally msvcrt.lib almost
certainly mentions msvcrt.dll explicitly.

The C run time source includes a makefile. With a bit of
tweaking you should be able to get it to work - I have.

You'll want to modify and rename the .def files to specify
the destination names of the DLLs. I seem to remember that
you also get better results if you put the CRT source in
_exactly_ the same path it was in when MS built it, because
some of the data is supplied only as object files, and the
linker is happier if the absolute paths are the same. If you do
a dumpbin /headers on the corresponding version of msvcrt.dll
and look at the debug entry you can find the complete path.

Play around with this for a bit, search for MSDN articles on
this topic, and let me know if you have any specific questions.

Quote:

> On Thu, 3 Jun 1999 18:42:09 -0600, "Andrew Osman"

> >That would be nice if we all knew how to rebuild the CRT!  M$ hasn't given a
> >way to do that as far as I and others know.

> >-Andy

--
.Bruce Dawson, Cavedog Entertainment.
Makers of Total Annihilation - http://www.cavedog.com


Tue, 20 Nov 2001 03:00:00 GMT  
 Compile with VC++ 6.0, link with older MSVCRT.dll?
No it won't the real name of the DLL you're linking to is hard coded in the
import lib.  You could rename the import lib and dll anything you like and
it'll still load the "wrong" DLL.

-Andy


Quote:
> I don't think it is necessary to rebuild the dll, though. Copy
> msvcrt.lib and msvcrt.dll to a directory, rename msvcrt.* to
> msvcrtprv.*, and link. That should do it, no?

> Rich

> On Thu, 3 Jun 1999 18:42:09 -0600, "Andrew Osman"

> >That would be nice if we all knew how to rebuild the CRT!  M$ hasn't
given a
> >way to do that as far as I and others know.

> >-Andy



> >> Rebuild msvcrt.dll. Call it RichardCRT.DLL and put it in your
> >> application's directory. Tweak your executables and DLLs so
> >> that they link with RichardCRT.DLL.

> >> Done.





> >> > >> I'm hoping the net might have some hints for how to achieve these
> >> > >> apparently goals for the products our company is developing:

> >> > >Have you tried statically linking the CRT?

> >> > Sorry, I forgot to put that one on the list.

> >> > Yes, we statically linked it. That works, but we have so many pieces
> >> > and parts that made the kit 4 times bigger. That option will be the
> >> > very last resort.

> >> > Rich
> >> > ---

> >> > rfortier at world.std.com, rfortier at highground.com

> >> --
> >> .Bruce Dawson, Cavedog Entertainment.
> >> Makers of Total Annihilation - http://www.cavedog.com



Tue, 20 Nov 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Problems with VC 6.0 MSVCRT.DLL

2. link error porting project file from old version to VC 6.0

3. VC 4.2 link error linking static libraries from VC 6.0

4. probably an old question, vc++ 6.0 errors

5. HELP: Compiler links code to wrong MSVCRT.DLL version

6. HELP: Compiler links code to wrong MSVCRT.DLL version

7. HELP: Compiler links code to wrong MSVCRT.DLL version

8. Static linking of msvcrt.dll

9. Code which used to compile in VC++ 6.0 gives C2593 error in VC++ .Net

10. Did VC 6.0 compile differently from VC 4.0?

11. Did VC 6.0 compile differently from VC 4.0?

12. upgrade of dll from vc++ 6.0 to vc++.net

 

 
Powered by phpBB® Forum Software