Click here to Skip to main content
15,890,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHelp with some memory - null issue Pin
alonchap30-Nov-09 3:49
alonchap30-Nov-09 3:49 
AnswerRe: Help with some memory - null issue Pin
Richard MacCutchan30-Nov-09 3:58
mveRichard MacCutchan30-Nov-09 3:58 
AnswerRe: Help with some memory - null issue Pin
David Crow30-Nov-09 5:36
David Crow30-Nov-09 5:36 
Questionconvert char to string Pin
nuttynibbles30-Nov-09 3:29
nuttynibbles30-Nov-09 3:29 
AnswerRe: convert char to string Pin
Richard MacCutchan30-Nov-09 3:56
mveRichard MacCutchan30-Nov-09 3:56 
AnswerRe: convert char to string Pin
«_Superman_»30-Nov-09 14:39
professional«_Superman_»30-Nov-09 14:39 
QuestionMinimized link time of C++ applications Pin
Fred Hebert30-Nov-09 2:47
Fred Hebert30-Nov-09 2:47 
AnswerRe: Minimized link time of C++ applications [modified] Pin
Rolf Kristensen3-Dec-09 11:35
Rolf Kristensen3-Dec-09 11:35 
Very interesting topic. I'm working with a 1 MLOC application with only static libraries, and funny enough we also have issues with linker times in Visual Studio Smile | :)

Our experience is this:

1) Incremental linker in debug-builds can give really fast link times (seconds compared to minutes). But if a change touches too many files, then it can actually cause the incremental linking to take twice the time of a full link.

2) Incremental linker doesn't work properly with static libraries by default. There is an option in VS2005 (and newer) called "Use Library Dependency Inputs" that will solve the issue by linking to all obj files in the library instead of the library itself. This is the same as Incredibuild IncrediLink (Aka. FastBuild).

3) Incremental linker doesn't work if using pragma comment to include the lib of a dll, and using relative path to the lib. The solution is to use the linker-option /LIBPATAH and not specifying path in the pragma comment.

4) Incremental linker can trip over its own feet and sometimes corrupt its incremental-helper-file (called .ilk). This can grow to a huge size (+200 MByte), and causes the incremental linker to fail or just take forever. Have implemented a pre-link step that checks that deletes the ilk-file if it looks corrupt.

5) Our datamodel objects inherits from a special template class, that implements a lot of type specific template methods. This cause a lot of implicit template instantiation all over the code. We got rid of that by declaring all methods on the template class as virtual.

6) Changing static libraries into DLLs really helps. But there is the issue about ensure code stability with versioning of DLLs so it matches properly (along with same compiler options). By compiling with Runtime CRT in a DLL, then it makes it easier to export classes, since it allows one to transfer objects over DLL boundary without needing to worry about which side should allocate/free the memory for the object.

7) Using Solid State Disks (SSD) for compiling and linking really helps performance. Good SSD disks are close to RAM in seek time and throughput (300 MByte/sec - SATA limit)

Some comments about the compiler/linker options you mentioned:
/Expectedoutputsize - There is a little documentation[^], but I never heard of it though. Will try it out.
/Ob1 - Inline function expansion should stay to default for debug-builds
/INCREMENTAL - Should only be used for debug-builds (never for release-buils). Can sometimes (As I have mentioned above) give longer linker times.
/Enable COMDAT folding - Should only be used for release builds as it slows the linker time (Can be considered for compiling debug-versions of dlls, as it will minimize the size of the debug-dll).
/Embedding manifest - If the incremental linker is working, then the embedding manifest is pretty much a no-op. If the incremental linker is having problems, then it can some times be a full link again. The manifest is kind of necessary now if wanting to mark your application as Vista/Win7 ready. You can consider leaving out the manifest for your own internal dlls, since it is the application manifest that controls everything.

It seems Microsoft have looked into pipelining the linker-process using threads in VS2010 (Coming marts 2010). This should improve linker times with 10%.

modified on Wednesday, December 9, 2009 12:06 PM

GeneralRe: Minimized link time of C++ applications Pin
Fred Hebert10-Dec-09 11:38
Fred Hebert10-Dec-09 11:38 
GeneralRe: Minimized link time of C++ applications Pin
Rolf Kristensen10-Dec-09 12:02
Rolf Kristensen10-Dec-09 12:02 
GeneralRe: Minimized link time of C++ applications Pin
Rolf Kristensen6-Jan-10 9:31
Rolf Kristensen6-Jan-10 9:31 
GeneralRe: Minimized link time of C++ applications Pin
Fred Hebert18-May-10 9:06
Fred Hebert18-May-10 9:06 
GeneralRe: Minimized link time of C++ applications Pin
Rolf Kristensen18-May-10 9:11
Rolf Kristensen18-May-10 9:11 
QuestionReg. win32_find_data dwFileAttributes value Pin
Rakesh530-Nov-09 2:25
Rakesh530-Nov-09 2:25 
AnswerRe: Reg. win32_find_data dwFileAttributes value Pin
Covean30-Nov-09 3:15
Covean30-Nov-09 3:15 
AnswerRe: Reg. win32_find_data dwFileAttributes value Pin
CPallini30-Nov-09 3:22
mveCPallini30-Nov-09 3:22 
QuestionHow to convert hundreds of VS2005 soltions to VS2008? Pin
coder21k30-Nov-09 2:18
coder21k30-Nov-09 2:18 
AnswerRe: How to convert hundreds of VS2005 soltions to VS2008? Pin
T210230-Nov-09 2:30
T210230-Nov-09 2:30 
GeneralRe: How to convert hundreds of VS2005 soltions to VS2008? Pin
KarstenK30-Nov-09 3:41
mveKarstenK30-Nov-09 3:41 
GeneralRe: How to convert hundreds of VS2005 soltions to VS2008? Pin
coder21k30-Nov-09 17:35
coder21k30-Nov-09 17:35 
AnswerRe: How to convert hundreds of VS2005 soltions to VS2008? Pin
Joe Woodbury30-Nov-09 9:28
professionalJoe Woodbury30-Nov-09 9:28 
AnswerRe: How to convert hundreds of VS2005 soltions to VS2008? Pin
22491730-Nov-09 14:52
22491730-Nov-09 14:52 
Questionhow to search for a record in a file. Pin
santhosh-padamatinti30-Nov-09 2:17
santhosh-padamatinti30-Nov-09 2:17 
AnswerRe: how to search for a record in a file. Pin
dxlee30-Nov-09 3:42
dxlee30-Nov-09 3:42 
AnswerRe: how to search for a record in a file. Pin
KarstenK30-Nov-09 4:25
mveKarstenK30-Nov-09 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.