Re: C run-time library
From: Doug Harrison [MVP] (dsh_at_mvps.org)
Date: 06/02/04
- Next message: Alexander Grigoriev: "Re: CreateProcess"
- Previous message: Doug Harrison [MVP]: "Re: delete"
- In reply to: Gil Hamilton: "Re: C run-time library"
- Next in thread: Gil Hamilton: "Re: C run-time library"
- Reply: Gil Hamilton: "Re: C run-time library"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 02 Jun 2004 12:21:42 -0500
Gil Hamilton wrote:
>>From a brief look at VC6 CRT source, I can only see a couple of
>problem areas
<snip>
Kudos for going to the trouble to analyze this as suggested. However, note
that the VC6 CRT source you have is just a snapshot in time, and what I said
earlier concerning -Zl usage holds, namely, "Just be certain to vet
everything with a high powered microscope with each compiler version and CRT
flavor you use, because as a -Zl fan, you're sacrificing a useful link-time
antibugging feature, while making promises that can be broken for you at any
time."
>All in all, I'm (provisionally) a convert. I'll at least try the /Zl
>approach next time I need to create a library like this.
You'll still need to create release/debug versions of your libraries, and
your library clients will need to ensure they link to the correct one. In
addition, if you compile your library with /MT, your /MD users will call the
many __declspec(dllexport) functions in the CRT slightly less efficiently.
Finally, as already mentioned, MS doesn't find this approach suitable for
MFC or the C++ Standard Library. I think to consider this idea for libraries
that use the CRT is to borrow trouble, and I've got better things to do,
especially when the benefits conferred by /Zl are insignificant.
I'll leave you with these KB articles.
INFO: /Mx Compiler Options and the LIBC, LIBCMT, MSVCRT Libs
http://support.microsoft.com/?kbid=128641
<q>
All modules and static libraries within an application should use the same
compile options (/ML, /MT, or /MD) and link to the library cooresponding to
the selected option.
</q>
PRB: MFC and CRT Must Match in debug/release and static/dynamic
http://support.microsoft.com/?kbid=166504
<q>
If you are linking to any static libraries that also link to MFC or the CRT,
you should ensure that every static library shares the same properties
(debug/release, CRT-static/dynamic) as the application.
</q>
-- Doug Harrison Microsoft MVP - Visual C++
- Next message: Alexander Grigoriev: "Re: CreateProcess"
- Previous message: Doug Harrison [MVP]: "Re: delete"
- In reply to: Gil Hamilton: "Re: C run-time library"
- Next in thread: Gil Hamilton: "Re: C run-time library"
- Reply: Gil Hamilton: "Re: C run-time library"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|