X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=UgEvBMRK80ZfAoNA vuY750gwgNszx8XOXkAhe7l3sGXxlA/I6PsWxqPWFnjMwXIebKvQJYquErO6YFsM 6tnaX+XL6HJUPXDHVmjbIcW99qqXAT6ewt488l7hF805rwXvIo8vIJMxg4bHDbh3 YM+375OJamh/sUjX/SdtTM6wQLQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=jBAT9CavoWDgbGliSA4LCR mWylw=; b=k2H4QbgtMapJCRaLKx5iicz6PuW63HkJaIvodJXQgZnsGzlEc1rnds xPoFh4QNT/zfT42fUzqDrGyGFmhWIJWwtuOMn4v7rvGy/NJkMzXYTbVPVZA9ePSQ PoUgy+79mjmYVvH+JUSbmYXJCZbEN0iOCK7n3Z/hRkCHTiKge26/U= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=kaz, Kylheku, kylheku, Kaz X-HELO: z8.zimbrahostedemail.com Subject: Re: Problem with differences with DLOPEN / DLSYM compared to ubuntu (16.04) / debian (stretch). To: cygwin AT cygwin DOT com References: From: Gary Schneir Message-ID: Date: Fri, 15 Sep 2017 06:51:32 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v8FDpslM012486 Thanks for the response but I am a little confused by it.  If Cygwin is supposed to provide POSIX API functionality and DLOPEN / DLSYM are supported in CYGWIN, then I shouldn't care about the underlying complexity or restrictions of running within the Windows environment and using DLLs.  The behavior should be the same as in other POSIX environments. If you are saying that I did not include some sort of __declspec(dllexport) directive in my code so that it can find my symbols, that is something else but you indicate that you think cygwin hides that complexity in shared libraries. Gary On 09/14/2017 06:15 PM, Kaz Kylheku wrote: > On 14.09.2017 08:44, Gary Schneir wrote: >> Can anyone provide some assistance to understanding the differences and >> a way get a single code base to work in all three environments without >> naming the library file? > > On Cygwin, libraries are Windows DLL's. That appears to be a > conscious project decision. > > The TL;DR is that Windows DLL's are not going to give you the > behaviors of ELF > shared libraries on GNU/Linux. Cygwin would probably have to whip up > its own > shared library format for that, or port one. > > The complication doesn't seem worth it. > > You can think of dlopen as a wrapper around LoadLibrary, and dlsym > doing GetProcAddress. > > In Windows programming, doing GetProcAddress on symbols within an .exe > is something > that isn't normally done; it's not clear that it is supposed to work > at all. > > For it to even have any hope of working, the function would have to be > somehow > declared "dllexport" (in Visual C terms). > > I think the shared lib building mechanism under Cygwin hides that; > there is no > Visual C __declspec(dllexport) stuff: > > See: https://cygwin.com/cygwin-ug-net/dll.html > > Still, the toolchain has to be arranging for the equivalent of > __declspec(dllexport) > for the external symbols. > > It's probably not configured to do that for the symbols in a regular > executable. > > > > -- > Problem reports:       http://cygwin.com/problems.html > FAQ:                   http://cygwin.com/faq/ > Documentation:         http://cygwin.com/docs.html > Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple