Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx1.pub.mailpod2-cph3.one.com ([10.27.25.11])
	by mailstorage18.cst.mailpod2-cph3.one.com with LMTP id wBrqCOJvXFtZAwAAQS8vrQ
	for <filtered@awaresystems.be>; Sat, 28 Jul 2018 13:30:10 +0000
X-HalOne-ID: 585d6011-926a-11e8-bcd9-e0d848957041
Received: from mail-yb0-f170.google.com (unknown [209.85.213.170])
	by mx1.pub.mailpod2-cph3.one.com (Halon) with ESMTPS
	id 585d6011-926a-11e8-bcd9-e0d848957041;
	Sat, 28 Jul 2018 13:30:08 +0000 (UTC)
Received: by mail-yb0-f170.google.com with SMTP id l16-v6so3098089ybk.11
        for <filtered@awaresystems.be>; Sat, 28 Jul 2018 06:30:08 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :date:from:to:in-reply-to:message-id:references:user-agent
         :mime-version:cc:subject:precedence:list-id:list-unsubscribe
         :list-archive:list-post:list-help:list-subscribe
         :content-transfer-encoding:sender:errors-to;
        bh=A8UbkPQFzvSnCARaPdRz4EpuIJZc2l39Zl+MOPQDeu4=;
        b=dcJulZaYHExMlAgj/MFFl8dshoAtbvCyjcYIMKkqqaHdKJY2GmQQfYIfyhBo8g6A0P
         wb1jO115k48CZrBsxXsYRGD2pk9SKvlACT9+WY/IyLvI+0yKPkiX1g68jVZv+A98HYp0
         FoaWGlxrJEY6Wd5rGrQaBaOG5V4ENqFZ6+OLuj5EF5idfv2J6EO+41jPbI/8CGgK6Xf5
         lkjIWhboB9GbuCzN4/NpyMwiXeTbsCGngQi9mFMNAEuObmAtKdC8RCP6eTuUn/RBhhlq
         CKVyAmU8mtJymuIsXB3+K0EQJJN+y6Ji1DsoMIEhNZWPtDVWHZqvt5kbuVW6tQ/gTv0k
         jBlg==
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: AOUpUlFOPBH5tGX47Rk0GKzwNz5umuWY458abuyKml7iHkW9nULjFDxt
	5aOE0yU49KizoIhz03fg6aB9cJbnmPgFy+eflHer2JoT7Q0Ob/s=
X-Received: by 2002:a25:27c5:: with SMTP id n188-v6mr5816298ybn.200.1532784607652;
        Sat, 28 Jul 2018 06:30:07 -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 2002:a25:8683:0:0:0:0:0 with SMTP id z3-v6csp1826554ybk;
        Sat, 28 Jul 2018 06:30:06 -0700 (PDT)
X-Google-Smtp-Source: AAOMgpco6yo/HWIKj986OPdTq+PnAWXZFCtjGVfZ9IwtYTeG7VDTgCjKirow7NYbfnBzcja+03Wp
X-Received: by 2002:adf:81a3:: with SMTP id 32-v6mr9940741wra.9.1532784606178;
        Sat, 28 Jul 2018 06:30:06 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1532784606; cv=none;
        d=google.com; s=arc-20160816;
        b=s5CmuxaGObmKXmtyKiuFG5tDkU7Zkr3ZoAHbzWqiLSmpFDNngItAe34/J4uwWiQo6D
         j2PJDR9Bp3B4iWFw6OvQzvzBicr2hTF8GbRoD0MvIEi2VTmaC4v/3Xukdzgadp2pP9Em
         Y1RXzqGwXoVe3Uu3MFt7hJWZbJOsj3oFCYSOU2rainNdy/u8JDIsLmSU5+5CLoprLCjQ
         9/cIfGiWHPnTH+TBuEKWm8KzJomjETMO0d1L33i2xje/n6xckb74L4Nk8aeShT2SChSx
         k2fzJbldjtUkgL2xNLm9B5HTez09ZD1cH1mKHx/U1/2o1C5txew84VW0TBUp0Op8Bfye
         cD6g==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
         :list-post:list-archive:list-unsubscribe:list-id:precedence:subject
         :cc:mime-version:user-agent:references:message-id:in-reply-to:to
         :from:date:arc-authentication-results;
        bh=A8UbkPQFzvSnCARaPdRz4EpuIJZc2l39Zl+MOPQDeu4=;
        b=SlLBD0kJP9bqtIj+uv4VRghLBq59Cm3Fh/LtEXAbgtf+/ueZX++IixPHqXkewdYpKZ
         k+slnCV1ocGDoyBSbnwmHtnx/tcqrBPv8O5nSRTwDVpbvOtQ4Nh/tKSzDvmN3MT7qmPc
         h8Z4R/RPZuN6CYeky5eAFjlkx+TDCxSjLkucz4jCTtCfLo7VGOsf3+6uHk/mlo1odjQG
         s8P9upiCbQF6R97mWyPobirWGF8ojyxoegVWPWVKNxMmTftgE4qVonCPa9ODxn9i1hhN
         k7gs2oafYrGDenYVoYMjyrwCaSj9NCusvrV1Gzf+Kn2Ssvf4OFdE2dE9S2ozLUANpxTP
         ULKg==
ARC-Authentication-Results: i=1; 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
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 y18-v6si1328764wrl.91.2018.07.28.06.30.05;
        Sat, 28 Jul 2018 06:30:06 -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 2D3E435C029;
	Sat, 28 Jul 2018 08:29:08 -0500 (EST)
Received: from smtp.simplesystems.org (smtp.simplesystems.org [65.66.246.90])
	by lists.maptools.org (Postfix) with ESMTPS id 3C1C535C027
	for <tiff@lists.maptools.org>; Sat, 28 Jul 2018 08:28:48 -0500 (EST)
Received: from freddy.simplesystems.org (freddy.simplesystems.org
	[65.66.246.65])
	by smtp.simplesystems.org (8.14.4+Sun/8.14.4) with ESMTP id
	w6SDSjlG008660; Sat, 28 Jul 2018 08:28:45 -0500 (CDT)
Date: Sat, 28 Jul 2018 08:28:45 -0500 (CDT)
From: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
X-X-Sender: bfriesen@freddy.simplesystems.org
To: Alan Koohi <hystaspesk@gmail.com>
In-Reply-To: <CA+vLUQbAewpwHBNMqvJ2r6pGpYQNn787bPYUY=P1DiFnGUeDNw@mail.gmail.com>
Message-ID: <alpine.GSO.2.20.1807280818020.3841@freddy.simplesystems.org>
References: <CA+vLUQbAewpwHBNMqvJ2r6pGpYQNn787bPYUY=P1DiFnGUeDNw@mail.gmail.com>
User-Agent: Alpine 2.20 (GSO 67 2015-01-07)
MIME-Version: 1.0
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
	(smtp.simplesystems.org [65.66.246.90]);
	Sat, 28 Jul 2018 08:28:46 -0500 (CDT)
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] libtiff (v3 / v4) maintain/use shared global state?
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 Fri, 27 Jul 2018, Alan Koohi wrote:

> Question: Does libtiff attempt at maintaining any sort of shared global
> state among the DSOs dynamically referenced by the same process?

Libtiff does still use a small number of global variables related to 
error/warning reporting (e.g. callback registrations).

> Background: I'm working on a plugin (C++) that ends up indirectly pulling
> in 2 different versions of libtiff (library X dynamically linked against
> libtiff v3.9.4 and library Y against libtiff v4.0.7) into the run-time
> environment through two 3rd party dependencies, which results in a
> segmentation fault crash due to a missing symbol (TIFFFindFieldInfo).
>
> Considering I can rebuild X and Y from source, but modifying the source is
> not an option, I tried to statically link libtiff v3.9.4 into library X to
> make all the libtiff symbols it needs locally available, which avoids the
> crash; I've been testing this for some time and can confirm this solves the
> missing symbol problem.

Good.

> The only concern I have is whether or not libtiff maintains some sort of a
> global state which may be shared among all libtiff users (DSOs) referenced
> by the same process. If this is not the case, then I can go with the static
> linkage solution, otherwise it is probably not safe.

If it appears to work, then you are likely ok.  An issue with dynamic 
linkage is that you were likely getting a mix of symbols from both 
libraries.  This would cause a severe problem since the two libraries 
are quite different.  You may be able to fully static link your 
"library X" to assure that it is using the few globals from libtiff 
v3.9.4 and avoid the risk of the run-time linkage picking globals from 
the wrong library.

Bob
-- 
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
