home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!natinst.com!natinst.com!not-for-mail
- From: karmira@natinst.com (Apostolos Karmirantzos)
- Newsgroups: comp.os.ms-windows.programmer.win32
- Subject: Re: libcmt.lib & errno
- Date: 17 Nov 1992 16:45:02 -0600
- Organization: National Instruments, Austin, TX
- Lines: 49
- Message-ID: <1ebsleINN2jq@falcon.natinst.com>
- References: <1992Nov17.194903.14356@medusa.prime.com>
- NNTP-Posting-Host: falcon.natinst.com
- Keywords: libcmt libc errno multi-threaded
-
- matt@CIS.Prime.COM (Matt Judenfreund) writes:
-
- >Is there any info on how/when to use libcmt.lib (the multi-threaded C library)
- >and libc.lib (non=multi-threaded)?
-
- >I have been using the libcmt.lib, (by virtue of the standard makefile) and
- >everything was fine until I tried to access errno. If you do that two things
- >happen:
- > (1) the linker starts whining about multiple definitions of variables
- >(one from libcmt.lib and the other from libc.lib).
- > (2) errno remains resolutely stuck at 0.
-
- >So perusing <errno.h> I noticed that if _MT is #defined then errno is re-defined
- >to use a function _errno. Presuming that _MT stood for multi-threaded I dutifully
- >rebuilt with /D_MT and that worked fine.
-
- >Is that safe/normal? It certainly doesn't seem like it - if it was than I would
- >expect _MT to be defined as standard for the C compiler.
-
- >(I am currently using the July version of NT)
-
- >Matt
-
-
- No it is not safe to just link with libcmt.lib (because under the October release
- this isn't going to work). I had the same problem and I went through a few different
- "fixes" until I heard from Microsoft (through CompuServe) what is the correct way to
- solve the problem.
- ATTENTION: This instructions works only for mutli-thread applications. Don't
- follow them if you don't build a mutli-thread applications
- 1. Use $(guilibsmt) in your link line
- 2. Use $(cvarsmt) instead of $(cvars) ion your compile line
- 3. Do not extern errno in your code.
-
- As I said previously, this is the solution under the October release. (I don't know
- if it's going to work for the July release you are using).
- I would suggest to upgrade to the October release since it has quite a few bugs
- fixed.
- I hope that this will help
- Lakis
-
- --
- +--------------------------------+-------------------------------------------+
- | Karmirantzos Apostolos |E-mail: karmiran@natinst.com |
- +--------------------------------+-------------------------------------------+
- --
- +--------------------------------+-------------------------------------------+
- | Karmirantzos Apostolos |E-mail: karmiran@natinst.com |
- +--------------------------------+-------------------------------------------+
-