Reputation: 96556
If I already have an import library is there a way to create a .def
file from it? This is backwards from the normal thing you'd do - normally you create an import library from a .def
file. Is there any way to do the opposite?
Upvotes: 0
Views: 3350
Reputation: 5233
It's possible - Microsoft tool dumpbin /exports <lib file>
can print what kind of symbols reside in static library.
But symbols are mostly mangled.
You can use additional python script to filter out to determine what you want to export and what not to export.
This works quite well for functions, but does not work well for data at the moment.
Here is one sample repository:
https://github.com/tapika/test_lib2def
Which can demo you how it works.
I guess exporting this way is recommended for huge size libraries, where export/not to export can be changed afterwards without the need to recompile all libraries again. (E.g. detection of what to export could be based on namespace or other attributes)
If you're developing library from scratch and you're confident on what you export and what not export - then easier and better to use normal __declspec(dllimport|dllexport)
.
Upvotes: 1