8

I have shared library file (libmylib.so), but have no header file (mylib.h) for it.

Do you know some ways/tools to generate this header file from shared library file?

dzav
  • 545
  • 1
  • 10
  • 25
  • 1
    Probably impractical, if not impossible. Where did you get this .so file? – Fred Larson Apr 24 '13 at 16:19
  • I want to use my old library with many useful functions. I remove this library with source many years ago. Now I found so-file and just want to see existing methods. I can restore some methods and can call them, also I remember names for some methods, but not remember order of parameters and structures. Of course, I can use disassembler, but first I try to found more easy way. – dzav Apr 24 '13 at 16:51
  • 1
    You might look at some of the answers to this question: http://stackoverflow.com/q/711220/10077 – Fred Larson Apr 24 '13 at 16:55

1 Answers1

7

This is impossible in general, since the .so file does not contain enough information about the parameter lists - especially if non-standard types (structs, e.g.) are being used, since type information is not part of the .so file.

Even if only standard types are used, the argument list is not part of the ELF symbol table (see http://refspecs.linuxbase.org/elf/elf.pdf 1-15ff.).

However, if the library is not stripped (= it contains debugging information), the DWARF-part does contain information about parameter lists, see How to extract function prototypes from an elf file? for details.

Community
  • 1
  • 1
urzeit
  • 2,863
  • 20
  • 36