Intimate contact vc6.0 compiler
Everyone may have been using VC development software, but it is not necessarily known for this compiler. There are many reasons. In most cases, we only stay in "use" it, and not to "understand" it. Because it is just a tool, we would rather put more energy in C language and software design. We are accustomed to such a "model": establish a project, then write code, then compile, repeat the debugging. However, the so-called: "Experience in a good thing, must first make a tool". If we pay more than the VC development environment, can we do more? Gossip less. Let's first take a look at the process of VC and is roughly divided into two steps: compilation and connection. The source file generates the .Obj file by compiling; all .Obj files and .lib files generate a .exe file or .dll file. Below, we discuss some details of these two steps. Compile parameters set. Mainly through the VC's menu item Project-> settings-> C / C page is completed. We can see the content of this page of the bottom Project Options, generally as follows: / Nologo / MDD / W3 / GM / GX / Zi / OD / D "WIN32" / D "_debug" / d "_windows" / D "_Afxdll" / d "_mbcs" /fp"debug/writingdlgtest.pch "/yu"stdafx.h" / fo "debug /" / fd "debug /" / fd / gz / c "representative" / FD / GZ / C various parameters represent "can be referenced MSDN. For example, / NOLOGO indicates that the output window is not displayed in the output window (we can remove this parameter to look at the effect), etc.. Generally we do not directly modify these settings, but through the top Category in this page. 1) General: Some overall settings. WARNING LEVEL is used to control the warning message, where Level 1 is the most serious level; Warnings as Errors will be warned as an error handling; Optimizations are code optimization, and you can make a thinner setting in the category's Optimizations; Generate Browse INFO To generate .sbr file, record class, variable, etc., you can make more settings in Category's Listing Files item. Debug Info, generate debugging information: None, does not generate any debug information (comparative faster); line number only generates debugging information of global and external symbols to .Obj file or .exe file, reduce the size of the target file; C 7.0-compatible, record all symbol information used by the debugger to the .obj file and .exe file; Program Database, create a .pdb file to record all debugging information; Program Database for "Edit & Continue", create a .pdb file record all debugging Information, and support the debugging.
2) C Language: Pointer_to_member representation Used to set the relationship of class definitions / references, generally Best-Case Always indicates that this class is defined before the reference class; Enable Exception Handling, synchronized exception handling; Enable Run-Time TYPE INFORMATION Forces the compiler to increase the code to perform object type check at runtime; Disable Construction Displacements, setting the class construction / destructor calling virtual function problem. 3) Code Generation: Processor Represents code instruction optimization, can be 80386, 80486, Pentium, Pentium Pro, or Blend represents various optimizations. Use Run-Time Library is used to specify the runtime library used by the program runtime (single thread or multi-thread, Debug version or Release version), there is a principle that one process does not use several versions of the runtime library. Single-Threaded, LIBC.LIB static link library; Debug Single-Threaded, LIBCD.LIB static link library; Multithreaded, LIBCMT.LIB static link library; Debug Multithreaded, LIBCMTD.LIB static link library; Multithreaded DLL, dynamic link MSVCRT.DLL The library; Debug Multithreaded DLL, dynamically connect the MSvcrtd.dll library. Connecting a single-line library does not support multi-threaded calls, connecting multi-thread libraries requires creating multi-threaded applications. Calling convention can be used to set the call convention, there are three types: __ cdecl, __ fastcall and __stdcall. The main difference between various calls is that the function is called, the parameter of the function is pressed from left to right or from right to left. When the function returns, the caller is cleaned into the stack. Still cleaning by the function itself; and naming modifications to the function name at compile time (you can see various named modifications via Listing Files). Struct Member Alignment is used to specify the member variables in the data structure in memory, and the speed of alignment data is different depending on the number of bits of the computer data bus. This parameter is especially important for applications such as packet network transmission, not access speed issues, but the accurate definition of data bits, generally using #pragma packs in the program.
4) Customize: Disable language Extensions, indicating that the language extension does not use Microsoft to standard C; Eliminate Duplicate Strings is mainly used for string optimization (put the string into the slow pool to save space), use this parameter, make Char * sbuffer = "this is a character buffer"; char * tbuffer = "this is a character buffer"; SBuffer and TBuffer point to the same memory space; Enable Function-Level Linking, tell the compiler to packet format each function Compilation; Enables Minimal Rebuild, by saving the associated information to the .IDB file, enabling the compiler only to recompile the latest class definitions changed source files, improve compilation speed; Enable Incremental Compiration, the same information saved by .IDB file, only Compile the latest changes; Suppress Startup Banner and Information Messages, to control whether the parameters are output at the Output window. 5) Listing Files: The feature of Generate Browse Info has been mentioned above. Here you can make more settings. Exclude local variables from breakse info indicates whether the information of the local variable is placed in the .sbr file. Listing File Type can set the content of the generated list information file: assembly-only listing only generates a compilet code file (.asm extension); Assembly With Machine Code generates machine code and assembly code file (.cod extension); askEMBLY with SOURCE Code generates source code and assembly code files (.asm extension); assembly, machine code, and source generates machine code, source code, and assembly code files (.cod extensions). Listing file name is the path to the generated information file, generally to automatically pick up the file name of the source file in the debug or release directory. 6) Optimizations: Code Optimization Settings. You can select Maximize Speed to generate the fastest code, or the minimize size generates a minimum size program, or Customize custom optimization.
Customized contents include: Assume No aliasing, do not use alias (increase speed); Assumeth Across Function Calls, only the alias is not used inside; Global Optimizations, global optimization, such as frequently used variables, or cycles Calculate optimization, such as I = -100; while (i <0) {i = x y;} will be optimized to i = -100; t = x y; while (i <0) {i = T;} generate Intrinsic Functions, replace some function calls (improve speed) using internal functions; Improve Float Consistency, floating point operations; Favor Small Code, program (EXE or DLL) size optimization is preferred for code speed optimization; Favor FAST Code, Program (EXE or DLL) code speed optimization is preferred in size optimization; Frame-Pointer Omiiss, does not use frame pointer to increase function call speed; Full Optimization, combine several parameters to generate the fastest program code. Inline function expansion, inline function extension three optimization (using inline can save functions, speed up the program speed): Disable does not use inline; only __inline, only the function definition has inline or __inline mark before using inline Any suitable, in addition to the INLINE or __INLINE tag, the compiler "I think" I should use the inline function, all inline. 7) Precompiled Headers: The settings for the precompiled head file. Use pre-compilation to improve the speed of repeated compilation. VC typically places some public, uncommon headers (such as AfxWin.h, etc.) in Stdafx.h, this part of the code does not have to recompile each time (unless it is Rebuild All). 8) Preprocessor: Pre-compiled processing. You can define / unwind some constants. Additional Include Directories, you can specify additional directorys, usually relative to the directory of this item, such as ../include. Connection parameters set. Mainly through the VC's menu item Project-> settings-> link page. We can see the content of this page of the bottom Project Options, generally as follows: / nologo / subsystem: windows / incremental: Yes /PDB: "debug/writingdlgtest.pdb "/ debug / machine: i386 / out:" Debug / WritingDlgtest.exe "/ pdbtype: Sept Let's take a look at the settings in category. 1) General: Some overall settings.
You can set the generated file path, file name; connected library file; Generate Debug INFO, generate debug information to .pdb files (set in category-> debug); Ignore All Default Libraries, Abandon all default library connections Link Incrementally, through the generated. ILK file implements incrementally connected connections to increase the subsequent connection speed, but generally generated files (EXE or DLL) generated in this manner; Generate MapFile, generate .MAP file record module related information; Enable Profiling This parameter is usually used simultaneously with the generate mapfile parameter, and if DEBUG information is generated, it cannot be used with .pdb files, and must use Microsoft Format. 2) Customize: This can be used to use the program database file. Force File Output, forcing the output file (EXE or DLL); Print Progress Messages can output progress information during the connection to the Output window. 3) Debug: Set whether to generate debugging information, and debug information format. Formats can have three options for Microsoft Format, Coff Format (Common Object File Format) and Both Formats; Separate Types, indicating that DEBUG format information is stored in separate .pdb files, or placed directly in the.pdb file of each source file. In the case, it means that the latter is used, which is fast to debug startup. 4) INPUT: Here you can specify the library file to be connected to abandon the library files. You can also add additional library file catalogs, usually relative to the directory of this item, such as ../lib. Force Symbol References, you can specify a library that connects specific symbol definitions. 5) Output: Base Address can change the program default base address (EXE file defaults to 0x400000, DLL default is 0x10000000), always try to start from this base address when the operating system is loaded. Entry-Point Symbol Specifies the entry address of the program, typically a function name (and must use the __stdcall call convention). General Win32 program, EXE's entrance is WinMain, the entry of the DLL is DLLLENTRYPOINT; it is best to let the connector automatically set the program's entry point. By default, through a C runtime library function: The console program uses MainCrtStartup (or WMAINCRTSTARTUP) to call the program's main (or wmain) function; Windows program uses WinMainCrtStartup (or wwinmaincrtstartup) calls to Winmain (or wwinmain) The __stdcall call convention must be used); the DLL uses the _dllmaincrtstartup calls the DLLMAIN function (must adopt the __stddcall call convention). Stack Allocations, used to set the stack size used by the program (please use the decimal), the default is 1 megabyte. Version Information tells the connector to put the version number on the beginning of the EXE or DLL file.