delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/01/22/22:49:57

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:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=WKQfO3alF3Wor7rAGi8kRtolUZHgj
Gz8SWkCZR0rTUnh4k0DlHA16wPZyjVSy6mOL+KOzbR7LJWCQHO4AkreEAHOENFm7
pVCT6ybd8p6x/DB98UvM+zn+Wq5gNS+TundoM6nR17Hls2WsoWd+/hEzK1aHzHjE
gebeokL9seLIHk=
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:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=s7BW2UitXPS7fs91aRR3hjsPVis=; b=o8J
S28sCych9ZvBBOnoZsgs3lc1rB9EateRBNylw9dBZTSKBT2wniVPK9EKMAMsmH4d
dXuOLwb/A3qDcwYs5QOWncALhwtgNqIX1LfmwFsp3n3TN3/NFa1YWiITWxEbPw8e
yD7b56g5G0Bfhh+1XwrNDo6LQBPi9/Y0kTc43WtY=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=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
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)
Date: Fri, 22 Jan 2016 19:49:34 -0800
Message-ID: <CABHT963DoTimY9woRrF_kcBSEeUhN2ONhrnnPFL-9CAmDt5geA@mail.gmail.com>
Subject: Problem with dlsym against libicu
From: Sam Habiel <sam DOT habiel AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

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 <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>


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 AT horus ~/fis-gtm-cygwin
$ gcc -Wall -otest.o test.c

sam AT horus ~/fis-gtm-cygwin
$ ./test.o
No such file or directory
sam AT horus ~/fis-gtm-cygwin
$ PATH=/usr/lib:/usr/bin:/usr/local/bin:. ./test.o
0x6aa40000
No such process
sam AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019