Re: Extracting data symbols from an archive using dlsym



I tried declaring it extern. But it is not able to execute. That is
why I tried going for the dlopen/dlsym approach. I think the
components of the archive are dynamic, it is not static. I know that
in AIX, members of a dynamic archive can be obtained using dlopen/
dlsym. But I am not sure that it can be done in Linux.

Regards,
Christina.

On Dec 3, 3:02 pm, sc...@xxxxxxxxxxxxx (Scott Lurndal) wrote:
Christina <christina.subscri...@xxxxxxxxx> writes:
Hi Everybody,

I have declared a static variable in a header file of a library that
times certain routines in the library. My application links to this
library. Before terminating, I want to print the value of this
variable. The library is in archive format. When I try using dlopen on
this library on Linux, I get the error, "library: invalid ELF header".

Does anybody have any idea, how to extract symbols from an archive
format?

Or does anybody have any other ideas about how to collect the timing
of routines in the library in a better way?

I would really appreciate any help and suggestion that anybody could
offer,

Warm Regards,
Christina.

If it is a static archive, and is linked with your application, simply
declare the variable 'extern' and access it directly.

scott- Hide quoted text -

- Show quoted text -

.



Relevant Pages

  • Re: extern
    ... >> without extern. ... > I'd *highly* suggest you use the extern keyword when declaring external ... 6.9.2/2 "A declaration of an identifier for an object that has file ... If a translation unit contains one or more tentative ...
    (comp.lang.c)
  • Re: using libc from nasm
    ... I am trying to learn asm with NASM on a FreeBSD system. ... I don't think declaring these "extern" in your file is going to help. ...
    (comp.lang.asm.x86)
  • Re: Why not auto?
    ... >>> be extern or auto makes even less sense than declaring it register. ...
    (comp.lang.c)
  • extern declaration of a function pointer
    ... I have a c program in which in a file i am declaring the following ... I want to use the same variable in another file as an extern. ... The compiler is giving me warnings and error. ... warning say conflicting type of a pointing to the same line. ...
    (alt.comp.lang.learn.c-cpp)