如何将循环依赖库迁移到VS2010 [英] How can I migrate cyclic dependend libraries to VS2010

查看:106
本文介绍了如何将循环依赖库迁移到VS2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将旧版应用程序从VS2003迁移到VS2010.不幸的是,在消除了编译器错误和大多数警告之后,我无法链接大多数库.问题在于,链接器所依赖的旧lib文件显然不足以用作链接器,并且由于周期性的依赖关系,我无法创建新的文件.

该应用程序由我们自己的十几个库以及几百个外部库组成.这些库中的两个库和主要的可执行文件是彼此依赖的,因此无法构建.

删除这些依赖项将是正确的解决方案,但是该项目是如此之大,将需要数周(甚至数月)的时间,而我现在没有时间.我一直在寻找仅创建lib文件而没有DLL的方法,但是经过半天的搜索并尝试了各种选项之后,我陷入了困境.

我发现的最有前途的想法是LIB工具,并使用.def文件(模块定义文件).它在较小的DLL上运行良好,因为它已经有一个existigng .def文件.然后我转向较大的文件,但是找不到任何.def文件,也没有找到任何简单的方法来创建文件.我发现的所有信息都表明我必须手动创建它,但是其中涉及数百个文件,以及数千个导出函数!更不用说我以前从未做过,并且不确定要包含哪些信息以及使用哪种语法.

有什么方法可以从无法正确链接的DLL源自动创建.def文件?还是有另一种方法来为DLL创建.lib文件,即使它本身依赖的.lib文件并不全部存在?

I''m currently trying to migrate a legacy application from VS2003 to VS 2010. Unfortunately, after eliminating compiler errors and most warnings, I fail to link most of the libraries. The problem is that the old lib files that the linker is relying on are apparently not sufficient for the linker, and I cannot create new ones because of cyclic dependencies.

The application consists of a dozen of our own libraries as well as a few hundred external ones. Two of these libraries and the main executable are dependend on each other, and thus cannot be built.

Removing these dependencies would be the proper solution, but the project is so huge, it would take weeks, if not months, and I don''t have that time right now. I''ve searched for ways to create just the lib files, without the DLLs, but after half a day of searching and trying various options I''m stuck.

The most promising idea I''ve found is the LIB tool, and using a .def file (Module Definition File). It worked well on the smaller DLL, as it already had an existigng .def file. Then I turned to the bigger one, but I couldn''t locate any .def file, and didn''t find any easy way to create one. All the info I''ve found indicates I have to manually create it, but there are hundreds of files involved, and thousands of exported functions! Not to mention I''ve never done it before and am unsure of what info to include, and what syntax to use.

Is there any way to automatically create a .def file from the source of a DLL that I cannot properly link? Or is there another way to create the .lib file for a DLL, even if the .lib files it itself depends on are not all present?

推荐答案

有"在这里的文章:

在只有.dll和.h文件的情况下如何创建.lib文件 [ http://support.microsoft.com/kb/131313 [
There''s an article here:

How to create .lib file when you only have .dll and .h files[^]

And there is a MS kb article here:

http://support.microsoft.com/kb/131313[^]

Basically, take the dll''s that were built with VS2003 and use

dumpbin.exe /export mydll.dll

to get a full list of the exports.

You''ll then need to modify the output of that into a valid .DEF format. The codeproject article gives you a brief description of .DEF file formats.

I think you''ll need a specific column from the dumpbin output that you''ll use as the EXPORTS section of your .DEF file. You can either extract the column with an editor that lets you select columns, or you can use your favorite regular expression editor or search and replace function (personnally I''d use sed or awk, but I''m old school).

Then use the lib tool.


这篇关于如何将循环依赖库迁移到VS2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆