Re: single threaded, multithreaded compilation

From: Chuck Dillon (cdillon_at_nimblegen.com)
Date: 10/16/03


Date: Thu, 16 Oct 2003 08:54:44 -0500

John Eskie wrote:

> In Microsofts compiler VC++ there are setting where you must choose if you
> want to compile your code as single threaded/multithreaded or MT dll. If you
> distribute libraries then you will end up having to compile the code in each
> three variants so users won't have linker problems. Can anyone explain why
> it works like this?

Because under Winders DLLs are not well designed particularly WRT how
they handle the C Runtime librarIES. The following is from the MSDN
page that documents the different compiler/linker switch that select
the C runtime to use...

<MSDN>
Note Having more than one copy of the run-time libraries in a process
can cause problems, because static data in one copy is not shared with
the other copy. To ensure that your process contains only one copy,
avoid mixing static and dynamic versions of the run-time libraries. The
linker will prevent you from linking with both static and dynamic
versions within one .EXE file, but you can still end up with two (or
more) copies of the run-time libraries. For example, a dynamic-link
library linked with the static (non-DLL) versions of the run-time
libraries can cause problems when used with an .EXE file that was
linked with the dynamic (DLL) version of the run-time libraries. (You
should also avoid mixing the debug and non-debug versions of the
libraries in one process.)
</MSDN>

-- ced

>
> So far I know GCC doesn't work the that way. Can anyone tell more on this?
>
> Thanks in advance.
> -- John
>
>

-- 
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.


Relevant Pages

  • Re: Carrying Libraries on Your Back...
    ... > Why not build on an installed based of assemblies, ... > than porting libraries around, ... download source code ... compile local source against header files ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using Lattice ispLEVER with VHDL libraries
    ... I am assuming there are some advantages to using the IDE rather than ... I also can't see to get Modelsim to work with ispLever, ... You will have to read about the tool you use to specify compile ... user defined libraries to get things to go under ispLever. ...
    (comp.arch.fpga)
  • Re: Getting started on the HP49g+
    ... either the original HP extable lib ... extable2 lib from http://www.hpcalc.org/details.php?id=3940. ... ask again if you have any problem installing libraries. ... compile the string with ASM (listed in the development lib menu, ...
    (comp.sys.hp48)
  • Re: hid.dll & VC++ 6
    ... but never to compile code based upon any current WDK. ... I'm tasked with writing an application to communicate with a USB card ... missing ')' before identifier 'HIDP_REPORT_TYPE' ... pointed it at the headers and libraries and it worked for a bit until i ...
    (microsoft.public.win32.programmer.kernel)
  • LNK2005: _DLLMain@12 already defined
    ... I got a dll that I written within my programming editor and I can compile it successfully with the following command line: ... When I compile, I am getting this linking error. ... I even followed the 2nd solution in the above KB using /verbose:lib which allowed me to isolate the libraries for importing coupled with a Ignore all default libraries. ...
    (microsoft.public.vstudio.development)