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=oHsM9ffr2HeuubkH QRRoz9H1F821hiqsDkAocIYdka8LAtv6e1NXa8cLNbDbd+xpIYXrn9BUm67CGPVs gJtoXnhmMBCdc44NyD+2oGeQssxaGoWwwhSAuu2VoRcTmAEBU0Uqjk7ht6u7zJ1p ktQuF+ibLMpgRUjezwr82s0IsQw= 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=5QXp4Ndsn7p86fhR1VBcwf vO514=; b=RxOYEZnv1rQYgRZ6kHCuKgCt3m8I9BRVEbRovsFa5c1ZimT5MzcE0V HTyzB0pskVJzu/kk8osqUthwjByVvxCvXD+AJKwHNqimnb3ZRDYnjY3xnDBPzxyy nKfBaNod5P0nu4/7qUyMPhpIZ5gAHkkPO9c6XbGpnEn5YQlBgfi3Q= 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: Yes, score=5.0 required=5.0 tests=AWL,BAYES_50,RP_MATCHES_RCVD,SPAM_BODY1,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=healthcare, improved!, sam, *ptr2 X-HELO: limerock04.mail.cornell.edu X-CornellRouted: This message has been Routed already. Subject: Re: Problem with dlsym against libicu To: cygwin AT cygwin DOT com References: From: Ken Brown Message-ID: <56A39A8D.5050807@cornell.edu> Date: Sat, 23 Jan 2016 10:21:49 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes On 1/22/2016 10:49 PM, Sam Habiel wrote: > Hello all. > > I am porting GT.M > (https://www.fisglobal.com/Solutions/Services/Database-Engine) to run > on Cygwin x86. My changes are here: > https://github.com/shabiel/fis-gtm/. GT.M is used in healthcare and > banking; I happen to work in the former field. > > The problem I am having is that GT.M opens libicuio via dlopen, and > then loads the function pointers into a data structure via function > name using dlsym. For the curious, the code is in gtm_icu_init() in > gtc_icu.c > > I took me a while, but I eventually figured out that dlls that are > opened via dlopen need to be in the PATH in Cygwin. I saw this in an > earlier Cygwin mailing list message. > > However, no matter what I do, I can't seem to get a non-null reference > to a named symbol in libicuio via dlsym. Here's what I tried: > > 0. nm shows the symbols in the file I want to open; strace shows me > opening it (it's /usr/lib/cygicuio56.dll). > 1. Compiled libicu from source with a flag for Cygwin: > http://site.icu-project.org/ > 2. Used underscores in front of the symbol > 3. Tried creating an import library using the instructions at > https://cygwin.com/cygwin-ug-net/dll.html#dll-build at the bottom and > then add the archive to the gcc compile command as a source file. > (These instructions need to be improved! I had no idea what to do with > a .a file after I got it). > > Here's a test program that I have written. Note that dlsym returns the > obscure error message "no such process", which doesn't make any sense > to me, as I am not looking for a "process" but a symbol. > > sam AT horus ~/fis-gtm-cygwin > $ cat test.c > #include > #include > #include > > > int main (int arg, char **argv) > { > void *ptr = dlopen("cygicuio.dll", RTLD_LAZY); > if (ptr != NULL) > { > printf("%p\n",ptr); > } > else > { > printf("%s",dlerror()); > exit(1); > } > > void *ptr2 = dlsym(ptr,"uset_open"); > > if (ptr2 != NULL) > { > printf("%p\n",ptr2); > } > else > { > printf("%s",dlerror()); > exit(1); > } > > return 0; > } I can't answer your questions, but I have some comments and questions. First, there's no /usr/lib/cygicuio56.dll in the Cygwin icu distribution. The DLL is /usr/bin/cygicuio56.dll, with the corresponding import library /usr/lib/libicuio56.dll.a (provided by the libicu-devel-56.1 package). And there's also a symlink /usr/lib/libicuio.dll.a -> libicuio56.dll.a. Next, can you show the nm command by which you found uset_open? I couldn't find it. I tried $ nm /usr/lib/libicuio56.dll.a | grep uset_open and got nothing. On the other hand: $ strings /usr/bin/cygicuio56.dll | grep uset_open uset_open_56 Could the problem be that uset_open (or uset_open_56) isn't exported? Ken -- 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