[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] non static libs on windows (dll)

From: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2003-03-24 22:42:38 CET

SteveKing wrote:
>>> 5) Due to the madness of windows memory management in a DLL
>>> system, I should never directly free something the dll allocated or
>>> vice versa, except via calls into the library for this express
>>> purpose.
>>
>> Subversion does not do this with the dlls it uses, and it would be
>> nice if it did. This is the reason we have to use different berkeley
>> db binaries for vc6 and vc7.
>
> That's not correct. The reason why there are different dll's for VC6
> and VC7 for the berkeley db is that VC7 uses a newer version of the
> C-runtime library.
> And according to MSDN these versions are not compatible, i.e. can't
> be used both from the same process.
> And since subversion also uses functions from the C-runtime lib (e.g.
> stdout)
> there must therefore also be two versions of the subversion dll.
>

I wasn't able to find any information on MSDN on this topic, but one of the
microsoft developers who worked on the C runtime explained the issue in
detail in some usenet posts:

http://groups.google.com/groups?selm=OeXwcqd2BHA.1288%40tkmsftngp07
http://groups.google.com/groups?selm=eFQ%23lcp2BHA.2112%40tkmsftngp02

It is perfectly ok to have many runtime libraries in the same process. There
are many situations where this can happen on windows. Different compilers
like borland, metrowerks, and cygwin's provide their own C runtimes, and
Visual C++ provides multiple runtimes (statically linked and dynamically
linked, single-threaded and multithreaded, debug and release). They can all
coexist.in one process because C runtimes are just plain old libaries on
windows, just optional wrappers over the win32 API.

One consequence of this is that calls to functions like malloc() can do
completely different things depending on what module (dll or exe) they take
place in and what runtime library the module is linked with. So you can't
malloc() some memory in dll A and free() it in dll B unless you can
guarantee that both DLLs are linked with the same runtime library. Because
subversion does do this with the berkeley db, it crashes when the berkely db
is linked with a separate runtime library. What Sean describes is good
practice that would have prevented this problem.

- Russ

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 24 22:41:39 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.