X-Recipient: archive-cygwin@delorie.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:to:subject:mime-version:content-type
	:content-transfer-encoding:date:from:in-reply-to:references
	:message-id; q=dns; s=default; b=FbtHBmX3XIXhifgnk0MesoYaDg8J3/T
	XZ+QWoZlDQnA8H72I/7hD3EK2jh3fns8Vlop1JQopljzLcDuCdOMp4t5Cl4XIwht
	J+E3+1XUse7XXEY6neYrHO+Nv793huz2/57299T5AdNSdoYMnEESdHefZnTaYT2F
	bvwPZTBpKfS8=
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:to:subject:mime-version:content-type
	:content-transfer-encoding:date:from:in-reply-to:references
	:message-id; s=default; bh=ml+JU2hptq1d4e/97tM89ba8ubw=; b=L9BnT
	ASgH+yoP4qkX6zU1F7A3stFgaJLdjCi4MbxXS7wCtg52qB9xfnbt4aJucb4eQTKr
	HrjPyvpLex2LZicqoqnT0szkRs0H9ek3Kw+BhU3vLhU9B8EPlNra7v7MD21Hzzt+
	0ocCNP6JZPjCcVuo1CaOVr0TVE+1g7hQrlT1+8=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=arrangements, Gary, gary, HX-PHP-Originating-Script:501
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=e552ceh/ c=1 sm=1 tr=0 a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=2JCJgTwv5E4A:10 a=w_pzkKWiAAAA:8 a=0ppCBi_oY1C-HinEWWoA:9 a=QEXdDO2ut3YA:10 a=sRI3_1zDfAgwuvI8zelB:22
To: cygwin@cygwin.com
Subject: Re: Problem with differences with DLOPEN / DLSYM compared to ubuntu  (16.04) / debian (stretch).
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Date: Wed, 20 Sep 2017 17:11:32 -0700
From: Kaz Kylheku <920-082-4242@kylheku.com>
In-Reply-To: <c1ea6bf0-171d-4f71-ee4e-c79f25214975@fhoosh.com>
References: <a39828e5534f3c67a59f404bb624c1d5@mail.kylheku.com> <c1ea6bf0-171d-4f71-ee4e-c79f25214975@fhoosh.com>
Message-ID: <41e4f6fcc85c65d2abe540f1ee975a0e@mail.kylheku.com>
X-Sender: 920-082-4242@kylheku.com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfEGIaJZQirUxi2Dj/QNwV9R+ZwBiWsC0MQHAjz87C4nHhycb00MGQwxj1N1GyEkRgWR1z3OEoG8R1PGwkql+a3QGgyMBXvRlXAAiAHe2kFsnHHFXbqG4 iON0NNim2v6RHeG2RvviBLqB8JIugzoHWNTUI+eTYf1MPrubSYD15Xez
X-IsSubscribed: yes

On 15.09.2017 06:51, Gary Schneir wrote:
> 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.

I don't see this behavior on Linux.

This is a transcript from an Ubuntu 16.04 system:

$ txr
This is the TXR Lisp interactive listener of TXR 186.
Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet.
1> (dlopen nil)
#<cptr dlhandle: 480918>
2> (dlsym *1 "cons")
#<cptr dlsym: 0>
3> (dlsym *1 "car")
#<cptr dlsym: 0>
4> (dlsym *1 "cdr")
#<cptr dlsym: 0>
5> (dlsym *1 "malloc")
#<cptr dlsym: b3fd70>
6> (dlsym *1 "printf")
#<cptr dlsym: b12ed0>

The external functions cons, car and cdr in the txr executable
(I assure everyone they are there) cannot be found by dlsym,
but malloc and printf in the linked C library are found.

I.e. the same issue you're having on Cygwin.

Cygwin aims for Linux compatibility more than POSIX. The motto
is "get that Linux feeling on Windows", after all.
It's splashed right below the Cygwin banner here:
https://cygwin.com/

Not finding the executable's own symbol with dlsym (unless
some special arrangements are made to dynamically export
the symbols) looks very much like a "Linux feeling"!

If we run "nm -D" on the executable to see what dynamic symbols
are provided, we find only "_init" and "_fini":

$ nm -D /usr/local/bin/txr | grep T
080fa3cc T _fini
0804a7a4 T _init

and, by golly, these *can* be found with dlsym on the
dlopen(NULL, ...) handle!

7> (dlsym *1 "_fini")
#<cptr dlsym: 80fa3cc>
8> (dlsym *1 "_init")
#<cptr dlsym: 804a7a4>


--
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

