gpt4 book ai didi

windows - pthread win32版本? ( Mongoose )

转载 作者:可可西里 更新时间:2023-11-01 09:22:06 26 4
gpt4 key购买 nike

请告诉我 pthread 版本之间有什么区别:VC2、VCE2 和 VSE2?如何选择我必须使用 Visual C++ Express 2010 for Mongoose webserver 库中的哪一个?

谢谢!!!

最佳答案

  • VCE - 带 C++ 异常处理的 MSVC dll
  • VSE - 具有结构化异常处理的 MSVC dll
  • VC - 带有 C 清理代码的 MSVC dll

您希望将哪一个与 VC++ Express 2010 一起使用取决于您希望如何处理 pthread 清理。如果您将其链接到 Mongoose 网络服务器(我不熟悉),我认为您会希望使用异常处理模型,因为该代码是用它编译的。

pthreads Win32 库有相当多的细节:

Library naming

Because the library is being built using various exception handling schemes and compilers - and because the library may not work reliably if these are mixed in an application, each different version of the library has it's own name.

Note 1: the incompatibility is really between EH implementations of the different compilers. It should be possible to use the standard C version from either compiler with C++ applications built with a different compiler. If you use an EH version of the library, then you must use the same compiler for the application. This is another complication and dependency that can be avoided by using only the standard C library version.

Note 2: if you use a standard C pthread*.dll with a C++ application, then any functions that you define that are intended to be called via pthread_cleanup_push() must be __cdecl.

Note 3: the intention was to also name either the VC or GC version (it should be arbitrary) as pthread.dll, including pthread.lib and libpthread.a as appropriate. This is no longer likely to happen.

Note 4: the compatibility number was added so that applications can differentiate between binary incompatible versions of the libs and dlls.

In general: pthread[VG]{SE,CE,C}c.dll pthread[VG]{SE,CE,C}c.lib

where: [VG] indicates the compiler V - MS VC, or G - GNU C

{SE,CE,C} indicates the exception handling scheme SE - Structured EH, or CE - C++ EH, or C - no exceptions - uses setjmp/longjmp

c - DLL compatibility number indicating ABI and API compatibility with applications built against any snapshot with the same compatibility number. See 'Version numbering' below.

The name may also be suffixed by a 'd' to indicate a debugging version of the library. E.g. pthreadVC2d.lib. Debugging versions contain additional information for debugging (symbols etc) and are often not optimised in any way (compiled with optimisation turned off).

For example: pthreadVSE.dll (MSVC/SEH) pthreadGCE.dll (GNUC/C++ EH) pthreadGC.dll (GNUC/not dependent on exceptions) pthreadVC1.dll (MSVC/not dependent on exceptions - not binary compatible with pthreadVC.dll) pthreadVC2.dll (MSVC/not dependent on exceptions - not binary compatible with pthreadVC1.dll or pthreadVC.dll)

The GNU library archive file names have correspondingly changed to:

libpthreadGCEc.a libpthreadGCc.a

如果您想了解每种清理模型的区别,请在 pthreads Win32 源代码中搜索“__CLEANUP”(不同清理模型只有少数几个地方发挥作用)。

关于windows - pthread win32版本? ( Mongoose ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4494453/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com