Generate header file (*.h) for on shared library file (*.so)

后端 未结 1 1834
清酒与你
清酒与你 2021-01-19 02:40

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 fil

1条回答
  •  走了就别回头了
    2021-01-19 03:26

    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.

    0 讨论(0)
提交回复
热议问题