什么是MSVC dll,静态库和导入库的正确命名约定 [英] What is proper naming convention for MSVC dlls, static libraries and import libraries

查看:250
本文介绍了什么是MSVC dll,静态库和导入库的正确命名约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,对于以下平台,库 foo

code>有以下约定:



Linux / gcc:

  shared:libfoo.so 
import:---
static:libfoo.a


$ b b

Cygwin / gcc:

 共享:cygfoo.dll 
import:libfoo.dll.a
static:libfoo.a

Windows / MinGW:

  shared:libfoo.dll 
import:libfoo.dll.a
static:libfoo.a

MSVC buidls应该使用什么?据我所知,通常名字是 foo.dll foo.lib ,但是你怎么通常区分导入库和静态库?



注意:我问,因为 CMake a href =http://art-blog.no-ip.info/cppcms/blog/post/54 =nofollow noreferrer>不愉快之间的冲突命名导入和静态库为 foo.lib 。请参见错误报告。答案将
帮助我说服开发人员修复这个bug。

解决方案

.dll由扩展名。但是,您可以通过 filename 而不是扩展名区分导入库和静态库。



对于构建为静态库的代码集,或者对于dll存在静态库的情况,不会存在导入库。这是两个不同的东西。



没有单一的MSVC标准文件名惯例。通常,以D结尾的库名称通常是库代码的调试版本, msvcrtd.dll vs msvcrt.dll 但除此之外,没有标准。


What is standard or "most-popular" naming convention for MSVC library builds.

For example, for following platforms library foo has these conventions:

Linux/gcc:

shared: libfoo.so
import: ---
static: libfoo.a

Cygwin/gcc:

shared: cygfoo.dll
import: libfoo.dll.a
static: libfoo.a

Windows/MinGW:

shared: libfoo.dll
import: libfoo.dll.a
static: libfoo.a

What should be used for MSVC buidls? As far as I know, usually names are foo.dll and foo.lib, but how do you usually distinguish between import library and static one?

Note: I ask because CMake creates quite unpleasant collision between them naming both import and static library as foo.lib. See bug report. The answer would help me to convince the developers to fix this bug.

解决方案

You distinguish between a library and a .dll by the extension. But you distinguish between a import library and a static library by the filename, not the extension.

There will be no case where an import library exists for a set of code that was built to be a static library, or where a static library exists for a dll. These are two different things.

There is no single MSVC standard filename convention. As a rule, a library name that ends in "D" is often a debug build of library code, msvcrtd.dll vs msvcrt.dll but other than that, there are no standards.

这篇关于什么是MSVC dll,静态库和导入库的正确命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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