[vorbis-dev] Re: win32sdk-1.0.1

Dimitry Andric dimitry at andric.com
Thu Oct 2 12:32:49 PDT 2003


On 2003-10-02 at 13:58:44 Ralph Giles wrote:

> The other thing on the list is that we've had complaints of wierd
> linking problems with the 1.0 SDK

Yes, I can imagine that. This is caused by inconsistent code
generation options in the VC6 project files used to build the SDK.

The problem is that Visual C++ really uses 3 different C/C++ runtime
libraries, and it can be the cause of very subtle errors if you mix
different types of these libraries together in any project.

In the SDK, as it is in CVS, I see the following:

  ogg_dynamic         -> links to libcmt.lib
  ogg_static          -> links to libcmt.lib
  vorbis_dynamic      -> links to msvcrt.lib
  vorbis_static       -> links to libcmt.lib
  vorbisenc_dynamic   -> links to msvcrt.lib
  vorbisenc_static    -> links to libcmt.lib
  vorbisfile_dynamic  -> links to msvcrt.lib
  vorbisfile_static   -> links to libcmt.lib

  (libcmt.lib is the static, multithreaded version of the runtime)
  (msvcrt.lib is the dynamic, multithreaded version of the runtime)

Therefore, since the vorbis libs need the ogg libs, there is already
an inconsistency in the runtime libraries used.

Also, if you want to build a project using the SDK, but you need to
use the single threaded C runtime, you will get all kinds of warnings
at link time, which advise you to "use the /NODEFAULTLIB switch". But
you should definitely NOT do that, but build a custom single threaded
version of the SDK.

<p>> We'd like the binaries to work with applications built on VC6, VC7,
> and VS.NET.

That is going to be quite difficult, if you insist on linking with the
dynamic VC++ runtime DLL. The problem is that these different versions
of VC++ all use different versions of the dynamic C runtime DLL.

* Visual C++ 5.0 and 6.0 link to msvcrt.dll or msvcrtd.dll.
* Visual Studio .NET 2002 (better to think of it as Visual C++ 7.0)
links to msvcr70.dll or msvcr70d.dll.
* Visual Studio .NET 2003 (really just Visual C++ 7.1) links to
msvcr71.dll or msvcr71d.dll.

<p>> I assume this is more than the faq about needing to link the same
> runtime library, unless there's actually a way around that.

Yes, you can use static linking. That should work in most cases, but
is still not guaranteed, since the semantics between different C
libraries don't have to be the same. This is also the case for major
versions of the GNU C library, for example.

Welcome to DLL and library hell. ;)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: part
Type: application/pgp-signature
Size: 184 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20031002/9bc2f9e5/part.pgp


More information about the Vorbis-dev mailing list