| Store | Cart

Re: [TCLCORE] zlib1.dll mysteries

From: Trevor Davel (Twylite) <twyl...@crypt.co.za>
Tue, 02 Sep 2014 17:48:56 +0200
Hi,

On 2014/09/02 05:23 PM, Donald G Porter wrote:
> If I assume the Tcl installation is one from ActiveTcl, would it be> sufficient to copy the zlib1.dll found beside ...\path\to\tclsh86.exe> over to also be beside ...\path\to\myExecutable.exe ?
It should be.

It is also safer (in principle) to use the .dll from ActiveTcl 
installation that from zlib.net, as the ActiveTcl one should be build 
against the same C runtime as the Tcl DLLs (more on that below).

Note that these DLLs may be build against MSVCRT.DLL (the zlib.net 
zlib1.dll is), which means that if you are deploying to older versions 
of Windows (pre-XP) you may also need to distribute MSVCRT.DLL (via the 
installer provided by Microsoft).

> Do all Tcl builds from source likewise place a zlib1.dll alongside> the tclsh.exe or wish.exe they install?  Are those also good for> copying where they are needed for escort services of embedding programs?
Well, maybe.  All your DLLs are dynamically linked against a C runtime 
library.  That could be LIBCMT, or MSVCRT, or MCVCR70/80/90/100 
depending on your compiler.  Each runtime library has its own heap.  If 
you allocate memory in one C runtime (on its heap), and try to 
deallocate it in another, you will crash your program.  This can also 
happen if you statically link to the C runtime!

Some developers are familiar with this problem and design their software 
accordingly (providing an appropriate Xfree() function for every 
Xalloc() so that heap association is maintained), but a lot of 
*nix-based software is not written in this fashion because it is seldom 
an issue on Linux or Free/OpenBSD.  There are (or have been) Tcl 
extension DLLs that are written the bad way.

Ideally you want your wish.exe, tcl86.dll and zlib1.dll to all be linked 
against the same C runtime.

Regards,
Trevor


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Tcl-Core mailing list
Tcl-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tcl-core

Recent Messages in this Thread
Donald G Porter Sep 02, 2014 02:14 pm
Trevor Davel (Twylite) Sep 02, 2014 02:34 pm
Donald G Porter Sep 02, 2014 02:46 pm
Trevor Davel (Twylite) Sep 02, 2014 03:12 pm
Donald G Porter Sep 02, 2014 03:32 pm
Trevor Davel (Twylite) Sep 02, 2014 03:54 pm
Donald G Porter Sep 02, 2014 04:37 pm
Trevor Davel (Twylite) Sep 02, 2014 05:07 pm
Andreas Kupries Sep 02, 2014 05:28 pm
Donald G Porter Sep 02, 2014 05:32 pm
Trevor Davel (Twylite) Sep 03, 2014 08:08 am
Donald G Porter Sep 02, 2014 03:13 pm
Donald G Porter Sep 02, 2014 03:23 pm
Trevor Davel (Twylite) Sep 02, 2014 03:48 pm
Jan Nijtmans Sep 02, 2014 03:24 pm
Donald G Porter Sep 02, 2014 06:52 pm
Donald G Porter Sep 02, 2014 06:55 pm
Jan Nijtmans Sep 03, 2014 07:53 am
Trevor Davel (Twylite) Sep 02, 2014 03:34 pm
Jan Nijtmans Sep 02, 2014 02:37 pm
Jan Nijtmans Sep 02, 2014 02:41 pm
Donald G Porter Sep 02, 2014 02:55 pm
Jan Nijtmans Sep 02, 2014 03:07 pm
Martin Lemburg Sep 02, 2014 03:15 pm
Michael Schlenker Sep 02, 2014 06:36 pm
Mich...@gmx.net Sep 02, 2014 08:10 pm
Donald G Porter Sep 03, 2014 12:34 pm
Mich...@gmx.net Sep 03, 2014 05:08 pm
Trevor Davel (Twylite) Sep 03, 2014 07:55 pm
Donal K. Fellows Sep 04, 2014 09:25 am
Donald G Porter Sep 02, 2014 02:40 pm
Messages in this thread