cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: VC8 Makefiles

From: Jonathan Arnold <jarnold_at_insors.com>
Date: Thu, 15 Mar 2007 15:37:53 -0400

Yang Tse wrote:
> 2007/3/15, Jonathan Arnold wrote:
>
>> I don't see any definitive reason why statically linking a DLL is a "bad
>> thing".
>
> Mainly It has to do with the following...
>
> If you build a DLL with C runtime static linkage you will use for the
> code inside the DLL the MS static C runtime.
>
> On the contary, if you build a DLL with C runtime dynamic linkage you
> will use for the code inside the DLL the MS dynamic C runtime.
>
> If afterwards you build a program in which you use both kinds of DLLs
> you will end up with a program in which part of the code is using the
> MS static C runtime and other parts the dynamic one.
>
> The biggest problem with that setting is that most probably at some
> point resources allocated by the MS static C runtime will be free'd by
> the MS dynamic C runtime or the other way round. And the fact is that
> since Windows has existed, each runtime has kept separate
> lists/counters for some resources. I'm unable to tell you exactly
> which ones.
>
> I cannot elaborate further but mixing static and dynamic MS C runtimes
> in a single program sooner or later breaks it with no apparent reason.
> At least funny messages as "the memory cannot be read or written"
> happen and in other cases it just crashes.

Yes, there is no doubt that mixing and matching MS C runtimes is a recipe for
disaster. But that doesn't really have anything to do with *using* a DLL, as
long as its C runtime is the same. In fact, it has to be the same. So if my
program uses static libs, I must have a DLL that uses static libs. Again, just
because I want to use curl as a DLL doesn't mean that my entire app needs to
be dynamic (we ran into a similar problem on Mac OSX, trying to not require
dynamic libraries to be delivered).

That's why, for ease of use, there needs to be 8 targets. The OpenSSL folks deliver
8 libraries too, so you can create all the versions of the DLL you might want
to use

-- 
Jonathan Arnold           Software Engineer
inSORS Integrated Communications, Inc
jarnold_at_insors.com Office/fax: 781.391.2818
Received on 2007-03-15