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

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

问题描述



例如,对于以下平台库 foo

code>有这些约定:



Linux / gcc:

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

Cygwin / gcc:

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

Windows / MinGW:

 共享:libfoo.dll 
import:libfoo.dll.a
static:libfoo.a
MSVC buidls应该使用什么应该使用哪一个?

据我所知,通常名称是 foo.dll foo.lib ,但是你如何通常区分进口图书馆和静态图书馆?



注意:我问,因为 CMake 一个href =http://art-blog.no-ip.info/cppcms/blog/post/54 =noreferrer>令人不快的它们之间的冲突将导入和静态库命名为 foo.lib 。请参阅错误报告。答案是
帮助我说服开发者解决这个错误。

解决方案

你区分图书馆和.dll由扩展名。但是您可以通过文件名区分导入库和静态库,而不是扩展名。



对于一组构建为静态库的代码,或者存在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天全站免登陆