* Downgrading from gcc 3.2.1 to gcc 2.96
@ 2003-10-14 11:04 puneet girdhar
2003-10-14 12:08 ` Claudio Bley
0 siblings, 1 reply; 2+ messages in thread
From: puneet girdhar @ 2003-10-14 11:04 UTC (permalink / raw)
To: gcc-help
Hi ,
I was using following code on gcc 3.2.1 on Linux.
#include <stdio.h>
#include <dlfcn.h>
int main()
{
char dll_name[100];
void * handle;
//lt_dlhandle hndl;
printf("which lib u want to print :");
scanf("%s",&dll_name);
printf("%s\n",dll_name);
handle = dlopen(dll_name,RTLD_LAZY);
Dl_info info;
void * gotaddr;
gotaddr=dlsym(handle,"_GLOBAL_OFFSET_TABLE_");
dladdr(gotaddr,&info);
printf("value of filename is
%s\n",info.dli_fname);
return 0;
}
This code was working fine with gcc 3.2.1. Now i want
to use this code with gcc 2.96 on linux. But it gives
the following error:
a.cpp: In function `int main ()':
a.cpp:13: `Dl_info' undeclared (first use this
function)
a.cpp:13: (Each undeclared identifier is reported only
once for each
function it appears in.)
a.cpp:13: parse error before `;'
a.cpp:16: `info' undeclared (first use this function)
a.cpp:16: `dladdr' undeclared (first use this
function)
What is way to run this code on gcc 2.96?
Thanks
Puneet
________________________________________________________________________
Yahoo! India Matrimony: Find your partner online.
Go to http://yahoo.shaadi.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Downgrading from gcc 3.2.1 to gcc 2.96
2003-10-14 11:04 Downgrading from gcc 3.2.1 to gcc 2.96 puneet girdhar
@ 2003-10-14 12:08 ` Claudio Bley
0 siblings, 0 replies; 2+ messages in thread
From: Claudio Bley @ 2003-10-14 12:08 UTC (permalink / raw)
To: puneet girdhar; +Cc: gcc-help
On Tue, Oct 14, 2003 at 12:04:42PM +0100, puneet girdhar wrote:
> Hi ,
> I was using following code on gcc 3.2.1 on Linux.
>
> #include <stdio.h>
> #include <dlfcn.h>
>
> int main()
> {
> char dll_name[100];
> void * handle;
> //lt_dlhandle hndl;
> printf("which lib u want to print :");
> scanf("%s",&dll_name);
> printf("%s\n",dll_name);
> handle = dlopen(dll_name,RTLD_LAZY);
> Dl_info info;
> void * gotaddr;
> gotaddr=dlsym(handle,"_GLOBAL_OFFSET_TABLE_");
> dladdr(gotaddr,&info);
> printf("value of filename is
> %s\n",info.dli_fname);
> return 0;
> }
>
>
> This code was working fine with gcc 3.2.1. Now i want
> to use this code with gcc 2.96 on linux. But it gives
> the following error:
>
> a.cpp: In function `int main ()':
> a.cpp:13: `Dl_info' undeclared (first use this
> function)
> a.cpp:13: (Each undeclared identifier is reported only
> once for each
> function it appears in.)
> a.cpp:13: parse error before `;'
> a.cpp:16: `info' undeclared (first use this function)
> a.cpp:16: `dladdr' undeclared (first use this
> function)
Have you already had a look at the dlfcn.h header file? Dl_info is
only defined when the __USE_GNU preprocessor macro is defined.
It seems GCC 3.x defines this macro when invoked as g++ or if the
source file is identified as c++ code. Otherwise it also doesn't.
--
Claudio Bley ASCII ribbon campaign (")
Debian GNU/Linux user - against HTML email X
http://www.cs.uni-magdeburg.de/~bley/ & vCards / \
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-14 12:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-14 11:04 Downgrading from gcc 3.2.1 to gcc 2.96 puneet girdhar
2003-10-14 12:08 ` Claudio Bley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).