/MD or /MT? dynamic or static

This is a discussion on /MD or /MT? dynamic or static within the Tech Board forums, part of the Community Boards category; MSVC2005 allows you to choose between using the lib and dll version of the Run-Time Library. With static one, required ...

  1. #1
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231

    /MD or /MT? dynamic or static

    MSVC2005 allows you to choose between using the lib and dll version of the Run-Time Library. With static one, required code will be included to your exe or dll. With dynamic one, a dll is required at run time, but it will make exe smaller.
    What are each one's benefits?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,406
    You basically outlined the pros and cons of each.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    I also guess static ones will load faster.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by siavoshkc
    I also guess static ones will load faster.
    Not necessarily. The bigger executable will take longer to load from disk into memory. The DLL will probably already be loaded, and just needs to be made available to the new process. On the other hand, the loader needs to do more work for the DLL than for the static lib.

    The statically linked program will take more physical memory from your computer, because it doesn't share its runtime with other programs.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Also your statically linked executable is just that: the code it's built with is the code it will always have. With the dynamic linked version, any updates to the dlls should positively affect your application (mostly; such updates may occasionally and unfortunately break it, too). It's for this reason that ms specifically recommend dynamic linking to ensure that, in particular, security updates propagate to your applications. Obviously, other improvements to the dll code itself will result directly in corresponding improvements to your applications' performance - in theory, anyway.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  2. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  3. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  4. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  5. [GLUT] Pointers to class methods
    By cboard_member in forum C++ Programming
    Replies: 13
    Last Post: 02-16-2006, 03:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21