From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77769 invoked by alias); 23 Jan 2016 03:49:39 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 77756 invoked by uid 89); 23 Jan 2016 03:49:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=6.5 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPAM_BODY1,SPF_PASS autolearn=no version=3.3.2 spammy=healthcare, improved!, sam, *ptr2 X-HELO: mail-vk0-f46.google.com Received: from mail-vk0-f46.google.com (HELO mail-vk0-f46.google.com) (209.85.213.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 23 Jan 2016 03:49:37 +0000 Received: by mail-vk0-f46.google.com with SMTP id k1so51095234vkb.2 for ; Fri, 22 Jan 2016 19:49:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=axQmmtgQLTrzjc2BFU+pq5FHcgEI0K2TPwliQ+kzNms=; b=Ua7QgPib0+75TygrVleF3b6MGvVDVSuD0+PyKsU/y4W/xnpMpga6XC2nA5sP+g2WB5 JPgYXdWINPbbYvaS4VCZbzuWPDjDxy2LT6tMCqPBYETA8NJSQ5MBlGTkKLo5M+PnMSle 84oumuGfYT7u+Qgs7Rr/tLfief+WAJOZHnfbeqtiQRczZzHeVvJAWBlLjgBlAQvVQTxa EB+nAMIBMGZhB2rwQ8PNdbh5jrF8zz80Lm6Jkg4MD8MaXwp4yMLYowYNB/koDtbTEKsa 8Dd9l9QqhIMc6JQByBZklqqOIaZH3D6+xaIsuZroO6X8slVFY9AglpQAJT3n+Juz9AFu pcJQ== X-Gm-Message-State: AG10YOR0ICu/1Zw8EdzpyHXzngWaLDwUZNJqk1ePuicKR1xCuBkcpQqd2UdSGfBNtoNc8awuFt8VyqQuVg6J4w== MIME-Version: 1.0 X-Received: by 10.31.172.135 with SMTP id v129mr4027465vke.154.1453520974596; Fri, 22 Jan 2016 19:49:34 -0800 (PST) Received: by 10.31.219.66 with HTTP; Fri, 22 Jan 2016 19:49:34 -0800 (PST) Date: Sat, 23 Jan 2016 14:35:00 -0000 Message-ID: Subject: Problem with dlsym against libicu From: Sam Habiel To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00308.txt.bz2 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@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; } sam@horus ~/fis-gtm-cygwin $ gcc -Wall -otest.o test.c sam@horus ~/fis-gtm-cygwin $ ./test.o No such file or directory sam@horus ~/fis-gtm-cygwin $ PATH=/usr/lib:/usr/bin:/usr/local/bin:. ./test.o 0x6aa40000 No such process sam@horus ~/fis-gtm-cygwin -- Sam Habiel, Pharm.D. VISTA Expertise Network -- 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