将 32 位 .def 文件转换为 64 位
在我的公司,我们使用 .def
文件来指定需要导出的符号。 (不幸的是,我希望我可以使用更现代和自动化的技术,那些决定生活在八十年代的人)。
使用手动复制粘贴手动编写 .def
文件很无聊且容易出错,但到目前为止我可以忍受。
但是,我需要为 64 位版本的 DLL 编写一个类似的 .def
文件。几个函数的名称修饰发生了变化,我想知道是否有办法从 32 位版本生成 64 位版本的 .def
文件。
您知道有什么工具可以帮助我吗?这现实吗?我真的不想再手工做一次了。任何解决方案,即使是涉及编写我自己的工具的解决方案,都是受欢迎的。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可能会 __declspec(dllexport) 我想要的符号,编译,然后在生成的 DLL 上运行 dumpbin /exports 以获取损坏的名称,然后您可以删除 __declspec 并创建一个 .def 文件。
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.
告诉你的老板回到 80 年代。说真的,这不是导出符号名称的可移植方式。如果 C++ 编译器更改名称修改方案怎么办?然后你就必须重新做一遍(jcopenha 所说的)。如果发生这种情况时你不在那里工作怎么办?另一个可怜的灵魂是否必须花费宝贵的时间来找出做什么以及如何做?我会尝试说服老板使用
__declspec(dllexport)
。它现在可以节省时间,将来也可能节省时间。我假设您正在导出类和重载函数。如果不是,那么我会用 C 名称导出函数。这些名称没有被破坏,也不会改变。
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.