如何在VS2005中将静态库项目转换为dll项目 [英] How to convert a static library project into a dll project in VS2005

查看:113
本文介绍了如何在VS2005中将静态库项目转换为dll项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在vs2005中创建一个项目时。
我也可以创建Win32-> Win32Project。
我可以选择
控制台应用程序
或 dll
或静态库

When I create a project in vs2005. I can also create Win32->Win32Project. I can choose "console application" or "dll" or "static library"

静态库项目。如何将其转换为dll项目。我在创建的项目的设置面板中找到的
。在常规->配置类型中,我可以将静态库(.lib)切换为DLL
,但是,在进行此设置之后。我确实得到了一个dll。但我对此没有兴趣。
,我不能在其他项目中使用它。如何在VS2005中将静态库项目转换为dll项目!

if I created a static library project. How can I convert it to dll project. I found in setting panel of the created project. General->Configuration Type, I can switch Static Library(.lib) to DLL However, after this setting. I does get a dll. but I do not have a lib with it. and I can not use it in other project. How to convert a static library project into a dll project in VS2005 many thanks!

推荐答案

我这样做的方式,以及这可能不是最佳方法,而是使用正确的设置(在本例中为DLL)创建一个新项目,然后使用要从静态库公开的向导创建存根方法。

The way I've done this, and this may not be the "best" way, was to create a new project with the right settings (DLL in this case) and then create the stub methods with the wizards that I want to expose from the static library.

然后,您有两种选择,可以将实际代码保留在静态库中,而仅将DLL中的存根插入静态库中,或者可以将代码从静态库项目中删除,然后完全淘汰静态库。

Then you have two choices, you can leave the real code in the static library and just have your stubs in the DLL call into the static library, or you can copy the code out of the static library project and retire the static library entirely.

第一种选择的优点是,您可以同时支持静态库和DLL,而无需重复大量工作。但是,如果您可以摆脱对静态库的完全支持,那么第二种选择可能会更好,因为您不必每次都在两个不同的项目中进行更改(将DLL中的存根方法和真实代码添加到静态库中)您要添加新的方法/属性。 YMMV

The advantage of the first option is that you can support both the static library and the DLL without having to duplicate a lot of work. But if you can get rid of supporting the static library entirely the second option is probably better because you don't have to make changes in two different projects (adding the stub method in the DLL and the real code to the static lib) every time you want to add a new method/property. YMMV

这篇关于如何在VS2005中将静态库项目转换为dll项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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