Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: <filtered@awaresystems.be>
Received: from mx4.public.one.com ([10.246.18.24])
	by mail6.local.one.com (Dovecot) with LMTP id 9TffJmm7hlfxrQAAsyOMew
	for <filtered@awaresystems.be>; Wed, 13 Jul 2016 22:08:37 +0000
X-HalOne-ID: 58e1fcd8-4946-11e6-a725-b82a72d0454d
Received: from mail-qt0-f181.google.com (unknown [209.85.216.181])
	by mx4.public.one.com (Halon Mail Gateway) with ESMTPS
	for <filtered@awaresystems.be>; Wed, 13 Jul 2016 22:08:36 +0000 (UTC)
Received: by mail-qt0-f181.google.com with SMTP id 52so33676175qtq.3
        for <filtered@awaresystems.be>; Wed, 13 Jul 2016 15:08:36 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :mime-version:from:date:message-id:to:subject:precedence:list-id
         :list-unsubscribe:list-archive:list-post:list-help:list-subscribe
         :content-transfer-encoding:sender:errors-to;
        bh=JuceSG1h4P2v2eZl57+88C/CQZZ9CV67YV+p4FHZ/cw=;
        b=S3ukxQcx9d0SYViUJuHlciqayOlCX5r0mYGL3G06pwPBVsSHjtOfiYHRyObqlCypMg
         Z4GHoUZMjI1v/MQhLhs/HgJJWHKB3d9dzP554EbtsaN4HFMPbEraCwGzK8/7A2NK0CP2
         1A9+3AKintjC95NjNU2HX9ea1Am2k1ovlo+/MfsNB0CpiLpQVflVbDiPfTlpEl5uMzM1
         F2XvmGijOCV0YZ+U+JaxO3NSWBEBGgPypwpUCqVODEnp9j3ufbg7VPDehA46uUeC7a0O
         9WPe6xjSiGnYwDPYZbNKee1c6fqfbzxmiQe7/NQ/x3wgggyuFa8TqKd8FrMAaYqQ0wtN
         A1cA==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
X-Gm-Message-State: ALyK8tK/nIvAIJfDo0NAea51M14ymQFEzG0/BFQLbvINxUjV9cnChTeihuN+iuxmy8cwojdNmFB8JdWGyHP3AKc9po0iYHQ=
X-Received: by 10.200.50.199 with SMTP id a7mr16073640qtb.43.1468447715360;
        Wed, 13 Jul 2016 15:08:35 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.55.147.129 with SMTP id v123csp120116qkd;
        Wed, 13 Jul 2016 15:08:33 -0700 (PDT)
X-Received: by 10.28.69.80 with SMTP id s77mr28405258wma.92.1468447713598;
        Wed, 13 Jul 2016 15:08:33 -0700 (PDT)
Return-Path: <tiff-bounces@lists.maptools.org>
Received: from lists.maptools.org (ks365428.kimsufi.com. [94.23.4.142])
        by mx.google.com with ESMTP id cf4si3108394wjc.78.2016.07.13.15.08.30;
        Wed, 13 Jul 2016 15:08:33 -0700 (PDT)
Received-SPF: neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=94.23.4.142;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id D9FB035C033;
	Wed, 13 Jul 2016 17:07:28 -0500 (EST)
Received: from mail-yw0-f180.google.com (mail-yw0-f180.google.com
	[209.85.161.180])
	by lists.maptools.org (Postfix) with ESMTPS id D8F6035C028
	for <tiff@lists.maptools.org>; Wed, 13 Jul 2016 17:07:14 -0500 (EST)
Received: by mail-yw0-f180.google.com with SMTP id w127so57041844ywf.3
	for <tiff@lists.maptools.org>; Wed, 13 Jul 2016 15:07:14 -0700 (PDT)
X-Received: by 10.37.214.210 with SMTP id n201mr5398610ybg.27.1468447632770;
	Wed, 13 Jul 2016 15:07:12 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.37.21.198 with HTTP; Wed, 13 Jul 2016 15:07:12 -0700 (PDT)
From: Bart Vandewoestyne <Bart.Vandewoestyne@telenet.be>
Date: Thu, 14 Jul 2016 00:07:12 +0200
X-Google-Sender-Auth: RN84BNx1LTKLXVGOZMfRfBXS9nw
Message-ID: <CAD-WWzgS+NNsCA9-y_MFQCppEpH=48hVDjcOh4k_cKm03Zk9Vw@mail.gmail.com>
To: tiff@lists.maptools.org
Subject: [Tiff] Visual Studio 2012: snprintf problem when linking with
	libtiff.lib
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

Hello list,

I am building LibTIFF 4.0.6 with Visual Studio 2012, using the nmake
approach from http://www.remotesensing.org/libtiff/build.html#PC.  I
now try to link my own program with libtiff by making sure that
libtiff.lib is found at link time.  However, I get the error:

libtiff.lib(tif_dirinfo.obj) : error LNK2019: unresolved external
symbol __TIFF_snprintf_f referenced in function __TIFFCreateAnonField

I noticed that in the function _TIFFCreateAnonField from
libtiff/tif_dirinfo.c a call to snprintf is made, which according to
https://msdn.microsoft.com/en-us/library/2ts7cx93(v=vs.110).aspx is
not available in Visual Studio 2012.  I also noticed a workaround is
being given in port/snprintf.c.  However, I'm not sure if I'm
correctly using the workaround.  In order to get my application to
link with libtiff, I also had to make sure that libport.lib was linked
in, by adding it to the list of libraries to link with, and by adding
the port directory to the list of directories to search for libraries.
So next to linking with libtiff.lib, I'm also linking with
libport.lib.

Is this the correct and recommended way of working around the snprintf
problem?  Can't I just link with libtiff.lib alone?  I thought that
would work, because `dumpbin /symbols libport.lib | findstr
__TIFF_snprintf_f` gives:

    00C 00000000 SECT4  notype ()    External     | __TIFF_snprintf_f

which i think means that the symbol is available in libport.lib, but
next to that, `dumpbin /symbols libtiff.lib | findstr
__TIFF_snprintf_f` gives:

    00C 00000000 SECT4  notype ()    External     | __TIFF_snprintf_f
    0FC 00000000 UNDEF  notype ()    External     | __TIFF_snprintf_f

Here, I do not understand why __TIFF_snprintf_f is being reported
twice: once in Section 4 and once as Undefined.  Clearly, I need more
understanding of the COFF symbol table to understand why libtiff.lib
is not enough for linking... or should it?

Kind regards,
Bart
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
