delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/09/23/15:53:20

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:in-reply-to:references:date
:message-id:subject:from:to:content-type
:content-transfer-encoding; q=dns; s=default; b=y6Q4+XnNXZPvvfkf
H3ydJFbts0Dwbq9scKT9NSuJHPc4AzuhdaLhy5mjIZHoFwqinuPPRLW/DuJTyn/I
tqitZJr45P6S0u0IqxASdA8I0kOhZ7GWL9Tn/j23ay+PuIFnJHEW0fibYZaPXPUm
pScjjXz/AM/T5u/ZrSxAmiAmpgA=
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:in-reply-to:references:date
:message-id:subject:from:to:content-type
:content-transfer-encoding; s=default; bh=XZoCzOkdu3S+z/1feXbWij
OY9RM=; b=H+qvm5A6YRcxMNW/iO8GBVlSsdQwzfxZIERXDy6mTckNLHpt1T3wxz
jpEKXAWO7HQq+qqNHmby4ZCuO/wxockSi5HlSgMLiF42yCrl8eNw7lZ3gtd+vfnk
Zr2gR9/xaJPLbitTUfSOPjkZG88rwDlP0+OOYL5kEHbWe8InWMh6k=
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: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-pa0-f53.google.com
MIME-Version: 1.0
X-Received: by 10.70.90.4 with SMTP id bs4mr3659794pdb.38.1411501977114; Tue, 23 Sep 2014 12:52:57 -0700 (PDT)
In-Reply-To: <5421CCA1.6000502@gmail.com>
References: <CAHAq8pFUmaSaiRc4LiLK+ieAqB_sPF8iaHFZQ=fzoM-3d+V5PQ AT mail DOT gmail DOT com> <5421CCA1 DOT 6000502 AT gmail DOT com>
Date: Tue, 23 Sep 2014 16:52:57 -0300
Message-ID: <CAHAq8pEWtSZ8F7bF=4-r2YSQmYnnYL0tcFuMp7gOW-va2g4=mg@mail.gmail.com>
Subject: Re: problem with dlsym to fetch address of some functions
From: =?UTF-8?Q?Paulo_C=C3=A9sar_Pereira_de_Andrade?= <paulo DOT cesar DOT pereira DOT de DOT andrade AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id s8NJrG6v023328

2014-09-23 16:40 GMT-03:00 Marco Atzeri <marco DOT atzeri AT gmail DOT com>:
> On 23/09/2014 20:43, Paulo CĂ©sar Pereira de Andrade wrote:
>>
>>    Hi,
>>
>>    Forgive me if this is expected. I am probably abusing dlsym
>> behavior on other systems.
>
>
> It will be much more clear if you

  Sorry for not clear initial problem description.

> 1) produce a simple small complete test case,

$ cat x.c
extern int sprintf(char*,char*, ...);
extern int puts(char*);
extern void *dlsym(void*, char*);
char buff[128];
int main(void) {
int (*fn)(char*,char*,...);
sprintf(buff, "%.1f", 1.0);
puts(buff);
fn = dlsym((void*)0, "sprintf");
(*fn)(buff, "%.1f", 1.0);
puts(buff);
return 0;
}

$ gcc -O0 -g3 x.c

> 2) explain the outcome you obtain (or not)

$ ./a.exe
1.0
f

> 3) explain the result you are expecting.

The expected result would be:

$ ./a.exe
1.0
1.0

> I had difficulties to understand what you are asking us.
>
> Marco

Thanks,
Paulo

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


- Raw text -


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