Is it possible to recreate the C++ header files needed to use a given .dll/.so/.dylib?
If it is, how would one go about doing that?
Is it possible to recreate the C++ header files needed to use a given .dll/.so/.dylib?
If it is, how would one go about doing that?
In general, no. There is a lot of information in header files (structure layouts, numeric constants, etc) that are not available in the dynamic library.
You may be able to recover some function parameter information if the library exports "decorated" C++ function names. However, even with that, you won't be able to get enough information to reconstruct a useful header file.
If the library exports undecorated names (with extern "C"
), then you're pretty much out of luck. All you know at that point is the function names.
That's called reverse engineering, and by itself is not an easy task, getting the function names and parameters is easy because of C++ name mangling, but recovering other data such as enumerations, constants and #defines used by the library can be a bit of a pain, because that data will be embedded into the assembly of the library.