Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-b.b-one.net (mx-b.one.com [91.198.169.49])
	by mail9.b-one.net (Postfix) with ESMTP id 621D440080A
	for <info@awaresystems.be>; Tue, 16 Feb 2010 23:09:01 +0100 (CET)
Received: by mx-b.b-one.net (Postfix, from userid 106)
	id 5A59B94377F4; Tue, 16 Feb 2010 23:09:01 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-b.b-one.net (Postfix) with ESMTP id 6770594377F4 for
 <info@awaresystems.be>; Tue, 16 Feb 2010 23:08:51 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id 0FBB61D52D077; Tue, 16 Feb 2010
 17:07:56 -0500 (EST)
Received: from mail-fx0-f227.google.com (mail-fx0-f227.google.com
 [209.85.220.227]) by lists.maptools.org (Postfix) with ESMTP id 412901D18F98A
 for <tiff@lists.maptools.org>; Tue, 16 Feb 2010 16:44:00 -0500 (EST)
Received: by fxm27 with SMTP id 27so65006fxm.5 for <tiff@lists.maptools.org>;
 Tue, 16 Feb 2010 13:43:59 -0800 (PST)
MIME-Version: 1.0
Received: by 10.102.17.40 with SMTP id 40mr5235062muq.119.1266356639479; Tue,
 16 Feb 2010 13:43:59 -0800 (PST)
In-Reply-To: <83C70DA01D8A4843AEFA5803F96EB4D4@KAM1720>
References: <BAY128-W274F37D0CF5213A6E728EAF14A0@phx.gbl>
 <4B7AA6D8.7030806@3delight.com> 
 <BAY128-W2871B6605E984F07C5072AF1490@phx.gbl>
 <alpine.GSO.2.01.1002161107180.25017@freddy.simplesystems.org> 
 <83C70DA01D8A4843AEFA5803F96EB4D4@KAM1720>
From: jcupitt@gmail.com
Date: Tue, 16 Feb 2010 21:43:39 +0000
Message-ID: <522c6461002161343v2042ab37l753fca7a860a7e00@mail.gmail.com>
To: Kevin Myers <kmyers1@clearwire.net>
Cc: Weichao Wang <weichao_wang@hotmail.com>, tiff@lists.maptools.org
Subject: Re: [Tiff] Using libtiff in Visual C++ 6.0
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On 16 February 2010 17:40, Kevin Myers <kmyers1@clearwire.net> wrote:
> So, you're saying that he can't (easily?) link to a libtiff DLL that has
> been built using GCC from an application that will be built using MSVC?

I used to think that linking on *nix systems could get a little hairy,
but it seems like it's fairly straightforward compared to Windows.

My understanding of the issue (I'm not a Windows person, so I may not
have this straight) is that things like mingw (ie. a gcc derivative
that targets Windows) produce DLLs that are linked against MSVCRT.DLL,
the standard C runtime that is present (in some form) on all Windows
machines since win95. They use this runtime for two reasons: 1) it's
everywhere, so installation of binaries which link against this is
easy and 2) because you don't need to distribute and install a
runtime, there are no licensing issues to consider.

MSVC 6.0 also uses this runtime, so projects built with this compiler
should work with the libtiff DLLs.

Sadly, later MSVC versions use a different runtime, usually called
msvcrt70.dll, or some higher number. MS changed the runtime name
because the runtime doesn't just supply functions like malloc, printf
and friends, it also supplies basic parts of C++, like the functions
supporting exception handling. MSVC7 and later have a new exception
system that breaks binary compatibility.

So ... versions of MSVC later than 6.0 will be unable to link against
the libtiff DLLs.

There is a workaround though. The Windows Driver Development Kit
includes a compiler which is able to link against he old MSVCRT and
which therefore should be able to use the libtiff DLLs. I think this
blog post is supposed to be the definitive explanation of this idea:

http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/

However as Bob says this is probably not worth the candle. You should
build your whole project with one compiler and not rely too strongly
on binary compatibility between compiler versions.

John
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
