This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: problem with dlsym to fetch address of some functions
- From: Paulo CÃsar Pereira de Andrade <paulo dot cesar dot pereira dot de dot andrade at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 23 Sep 2014 16:52:57 -0300
- Subject: Re: problem with dlsym to fetch address of some functions
- Authentication-results: sourceware.org; auth=none
- References: <CAHAq8pFUmaSaiRc4LiLK+ieAqB_sPF8iaHFZQ=fzoM-3d+V5PQ at mail dot gmail dot com> <5421CCA1 dot 6000502 at gmail dot com>
2014-09-23 16:40 GMT-03:00 Marco Atzeri <marco.atzeri@gmail.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