Reputation: 555
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?
Upvotes: 8
Views: 7422
Reputation: 2909
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.
Upvotes: 7