Question

In my company we use .def files to specify the symbols that need to be exported. (I wish I could use a more modern and automated technique, unfortunately, the guys who decide live back in the eighties).

Writing a .def file by hand, using manual copy-paste is boring and error-prone but so far I can live with it.

However, I need to write a similar .def file for the 64 bits version of the DLL. The name decoration of several function changed and I wonder if there is a way to generate a .def file for the 64 bits version from the 32 bits version.

Are you aware of any tool that might help me ? Is this even realistic ? I really don't feel like I want to do it by hand one more time. Any solution, even one that involves coding my own tool, is welcome.

Thank you.

Was it helpful?

Solution

I would probably __declspec(dllexport) the symbols I wanted, compile, and then run dumpbin /exports on the resulting DLL to get the mangled names, and then you can remove the __declspec and make a .def file.

OTHER TIPS

Tell your boss to go back to the 80's. Seriously, this is not a portable way to export symbol names. What if the C++ compiler changes the name mangling scheme? Then you'd have to do this (what jcopenha said) all over again. What if you don't work there when it happens? Is another poor soul going to have to spend valuable time to find out what and how to do it? I would try to convince the boss to use __declspec(dllexport). It'll save time now, and possibly time in the future.

I am assuming you are exporting classes and overloaded functions. If you are not, then I'd export the functions with C names instead. Those names are not mangled, and will not change.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top