home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 18.ddi / MFC / SRC / README.TX_ / README.TX
Encoding:
Text File  |  1993-02-08  |  8.2 KB  |  196 lines

  1.  
  2. =======================================================================
  3.             MICROSOFT FOUNDATION CLASSES 2.0 - SOURCE CODE
  4. =======================================================================
  5.  
  6. This directory contains the source code to the MFC library.
  7.  
  8. These files have been included for reference purposes, in
  9. conjunction with the Class Library reference manual and tutorial.
  10.  
  11. These files are compiled to form the Microsoft Foundation Classes 2.0
  12. (MFC 2.0).  The library may be built in a number of configurations, 
  13. depending upon operating system, memory usage or model, and whether 
  14. or not debugging and diagnostic aids are to be included in 
  15. applications which link with the library.
  16.  
  17.  
  18. ===========================================
  19.  1.  BUILDING A STATIC LINK LIBRARY VARIANT
  20. ===========================================
  21.  
  22. The makefile provided can be used to build the static link library
  23. variants of MFC 2.0.  See section 2 for instructions on building
  24. the shared DLL variant.  The makefile can be used from either the
  25. MS-DOS command line (in a Windows 3.1 DOS "box") or as an External
  26. Project file in the Visual WorkBench.  
  27.  
  28. To build a library in a particular configuration, use the NMAKE tool
  29. and the Makefile which is in this directory.  The following arguments
  30. can be given to NMAKE to successfully build a specific library variant.
  31.  
  32.   NMAKE {MODEL=[S|M|C|L]} {TARGET=[W|R]} {DEBUG=[0|1]} {DLL=[0|1]} \
  33.         {CODEVIEW=[0|1|2]} {OBJ=path} {OPT=<CL command line switches>}
  34.  
  35. To set these options from the Visual WorkBench use the Project Options
  36. menu command and set them in the Debug/Retail sections.  For example to
  37. build large model with browser information in the debug build use the
  38. following settings:
  39.  
  40.         Debug Build:  NMAKE DEBUG=1 TARGET=W MODEL=L OPT="/FR" CODEVIEW=1
  41.         Release Build: NMAKE DEBUG=0 TARGET=W MODEL=L
  42.  
  43. Note: On some systems there may not be enough real mode DOS memory to
  44. complete the build of the static link library.  Due to the overhead
  45. of the Visual WorkBench, an additional 40K of DOS real mode memory 
  46. is required in order to build as an External Project.  If you experience 
  47. an "out of memory" message in the LIB phase of the build, then you 
  48. should first try building from a DOS box.  If that does not succeed 
  49. then you will need to remove any real mode memory clients from 
  50. your CONFIG.SYS.  Approximately 500K DOS memory is required.  
  51. The MEM command can tell you the amount to memory available for a 
  52. running application.
  53.  
  54.  
  55. MODEL=[S|M|C|L]
  56.   The "MODEL" argument specifies the ambient memory model, which can be
  57.   one of S, M, C, or L (for Small, Medium, Compact or Large, respectively).  
  58.  
  59. TARGET=[W|R]
  60.   The "TARGET" argument specifies the operating-system on which your
  61.   compiled programs will run.  This may be one of W or R (for
  62.   Windows or Real-mode DOS, respectively).  R should be used only
  63.   for MS-DOS only targets (i.e. command line tools).
  64.  
  65. DLL=[0|1]
  66.   The "DLL" argument specifies whether or not to compile the library
  67.   so that it may subsequently be used for developing a dynamic link
  68.   library (DLL).  The default is DLL=0 (do not include DLL support).
  69.   If DLL=1, MODEL must be L (large).
  70.  
  71.   Note: Use the MFCDLL.MAK file for building the shared DLL (_AFXDLL).
  72.   The DLL=1 variant is for building your own DLL that contains MFC
  73.   classes and exports a C interface.  This is described in technical note
  74.   TN011 and is known as _USRDLL.
  75.  
  76. DEBUG=[0|1]
  77.   The "DEBUG" argument specifies whether or not to include diagnostic
  78.   support code for the library.  This may be 0 (for no diagnostics) 
  79.   or 1 (for full diagnostics).
  80.  
  81.   Note: The Small and Compact models do not support
  82.   DEBUG=1, they are for retail build variants only.
  83.  
  84. CODEVIEW=[0|1|2]
  85.   The "CODEVIEW" argument specifies whether to compile the library with
  86.   CodeView information or not.  You need to compile the library with
  87.   CodeView information if you want to trace into MFC code using CodeView.
  88.   You should also compile your application files with the /Zi option,
  89.   and link your executable with the /CODEVIEW option.
  90.  
  91.   Setting CODEVIEW does not affect the DEBUG argument, although the
  92.   value of the DEBUG argument does affect the default value of CODEVIEW
  93.   (discussed below).  A value of 0 indicates that no CodeView
  94.   information is to be compiled into the library.  A value of 1 says
  95.   to compile in full CodeView information for all modules of the library.
  96.   A value of 2 compiles CodeView information only into a select set of
  97.   the most commonly referenced modules (WinMain, diagnostic memory
  98.   allocator, message map, main message loop, and the application class.)
  99.  
  100.   The default value depends on the setting of the DEBUG argument.
  101.   If DEBUG=1, CODEVIEW defaults to 2.  If DEBUG=0, CODEVIEW also defaults
  102.   to 0.  The installed libraries have been built with CODEVIEW=1 for
  103.   maximum CodeView information.
  104.  
  105. OBJ=[path]
  106.   We recommend storing .OBJ files in a separate directory so that you
  107.   may compile different versions of the MFC library concurrently.
  108.   The "OBJ" argument allows you to specify where these files are stored
  109.   during the build process.  The directory specified is created and
  110.   removed automatically as required.  This defaults to a combination
  111.   of the target, model, and debug status, preceded by a '$' (i.e. $MWD).
  112.  
  113. OPT=[switches]
  114.   If your library needs to be built with custom compiler switches, then
  115.   these may be included in the "OPT" argument.  Note that switches need
  116.   to be separated by spaces, so when including more than one extra
  117.   compiler switch, enclose the whole OPT= argument in double-quotes.
  118.   This is an advanced feature; read the Makefile and the details on each
  119.   of the switches concerned in the Microsoft C/C++ Compiler User Manual
  120.   before using this option.
  121.  
  122. Defaults
  123.   The default is:
  124.       nmake MODEL=M TARGET=W DEBUG=1 CODEVIEW=2 OBJ=$MWD
  125.  
  126. Note:  If you wish to use only the non-Windows classes then build
  127. an 'R' (real-mode) library variant. There are three MFC sample applications
  128. that do not require Microsoft Windows, and use the real-mode libraries.
  129. See the WinHelp file MFCSAMP.HLP for details about each sample and
  130. which variant of the library each requires.
  131.  
  132. Note:  MFC 2.0 requires an additional static link library that is installed
  133. in the SRC directory.  This .LIB file contains some of the VBX control
  134. implementation.  You cannot regenerate this file yourself.  Should you
  135. accidentally delete it, you will need to retrieve the file from the
  136. Microsoft Visual C++ installation diskettes.  Small and Compact memory
  137. models do not support VBX controls.
  138.  
  139.  
  140. ============================
  141.  2.  BUILDING THE SHARED DLL
  142. ============================
  143.  
  144. Building the shared DLL is very similar to the static link
  145. variants.  You must, however, use the MFCDLL.MAK file which is
  146. also an External Project file.
  147.  
  148. Technical note TN033 explains in detail how to build the shared
  149. DLL and how to build an application that uses the shared DLL.
  150.  
  151.  
  152. ===============================
  153.  3. AFTER BUILDING THE LIBRARY
  154. ===============================
  155.  
  156. Once the library has been built successfully, you may want to delete
  157. object files with:
  158.  
  159.   NMAKE CLEAN OBJ=[path]
  160.  
  161. Note that if you used the "OBJ" argument while building the library,
  162. specify the same sub directory in the cleanup command.
  163.  
  164. This will remove all of the temporary .OBJ files created by building the
  165. library, and remove the directory where they were stored.
  166.  
  167. Always perform a cleanup before building a new variant of the library,
  168. or use different object paths for each variant.  Note that the OBJ files
  169. are only necessary during the building process.
  170.  
  171.  
  172. ======================================
  173.  4. SOURCE CODE FORMATTING CONVENTION
  174. ======================================
  175.  
  176. All MFC source code has been formatted such that leading whitespace
  177. on a line is made up of physical tabs, while embedded whitespace is
  178. physical spaces.  MFC source code assumes that your editor is set to
  179. display a physical tab as four blanks.
  180.  
  181. For example:
  182.  
  183. int FormatExample()
  184. {
  185. /*
  186. Statements below should start in column 5 if tabs are set correctly
  187. Comment should start in column 20
  188. 12345678901234567890
  189. */
  190.     int i;
  191.     i = 5;         // whitespace between statement and comment is spaces
  192.  
  193.     return i;
  194.  
  195. }
  196.