Downgrading from gcc 3.2.1 to gcc 2.96
Claudio Bley
bley@cs.uni-magdeburg.de
Tue Oct 14 12:08:00 GMT 2003
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 / \
More information about the Gcc-help
mailing list