home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / mswindo / programm / win32 / 2023 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  2.7 KB

  1. 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
  2. From: karmira@natinst.com (Apostolos Karmirantzos)
  3. Newsgroups: comp.os.ms-windows.programmer.win32
  4. Subject: Re: libcmt.lib & errno
  5. Date: 17 Nov 1992 16:45:02 -0600
  6. Organization: National Instruments, Austin, TX
  7. Lines: 49
  8. Message-ID: <1ebsleINN2jq@falcon.natinst.com>
  9. References: <1992Nov17.194903.14356@medusa.prime.com>
  10. NNTP-Posting-Host: falcon.natinst.com
  11. Keywords: libcmt libc errno multi-threaded
  12.  
  13. matt@CIS.Prime.COM (Matt Judenfreund) writes:
  14.  
  15. >Is there any info on how/when to use libcmt.lib (the multi-threaded C library)
  16. >and libc.lib (non=multi-threaded)?
  17.  
  18. >I have been using the libcmt.lib, (by virtue of the standard makefile) and
  19. >everything was fine until I tried to access errno.  If you do that two things
  20. >happen:
  21. > (1) the linker starts whining about multiple definitions of variables
  22. >(one from libcmt.lib and the other from libc.lib).
  23. > (2) errno remains resolutely stuck at 0.
  24.  
  25. >So perusing <errno.h> I noticed that if _MT is #defined then errno is re-defined
  26. >to use a function _errno.  Presuming that _MT stood for multi-threaded I dutifully
  27. >rebuilt with /D_MT and that worked fine.
  28.  
  29. >Is that safe/normal?  It certainly doesn't seem like it - if it was than I would
  30. >expect _MT to be defined as standard for the C compiler. 
  31.  
  32. >(I am currently using the July version of NT)
  33.  
  34. >Matt
  35.  
  36.  
  37.   No it is not safe to just link with libcmt.lib (because under the October release
  38. this isn't going to work). I had the same problem and I went through a few different 
  39. "fixes" until I heard from Microsoft (through CompuServe) what is the correct way to
  40. solve the problem.
  41.   ATTENTION: This instructions works only for mutli-thread applications. Don't
  42. follow them if you don't build a mutli-thread applications
  43. 1. Use $(guilibsmt) in your link line
  44. 2. Use $(cvarsmt) instead of $(cvars) ion your compile line
  45. 3. Do not extern errno in your code.
  46.  
  47.   As I said previously, this is the solution under the October release. (I don't know
  48. if it's going to work for the July release you are using). 
  49.   I would suggest to upgrade to the October release since it has quite a few bugs
  50. fixed.
  51.   I hope that this will help
  52.     Lakis
  53.  
  54. -- 
  55. +--------------------------------+-------------------------------------------+
  56. | Karmirantzos Apostolos     |E-mail: karmiran@natinst.com             |         
  57. +--------------------------------+-------------------------------------------+
  58. -- 
  59. +--------------------------------+-------------------------------------------+
  60. | Karmirantzos Apostolos     |E-mail: karmiran@natinst.com             |         
  61. +--------------------------------+-------------------------------------------+
  62.