📄 mssdoc.htm
字号:
</PRE>MSS will unzip itself into its own directory, './mss12/' (under DJGPP this will be %DJDIR%/contrib/mss12 if youfollowed the above recommendation), so there is no need to create a separate directory for MSS before unzipping the archive.<P>If you are using GCC, either under DOS or Linux this is a pretty easy task.<P> </P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="configuring-mss-for-your-compiler"><B>2.2 Configuring MSS for your compiler</B></A></FONT></FONT></TD></TR></TABLE><P>There are some configuring options available to make MSS more portable to diffrent compilers. These options can be found in the file `mss.h´, and consist of preprocessor directives (<CODE>#define</CODE> statements) in the beginning of the file (all marked clearly with comments). Some options may need to be defined to a specific value, and others control the behaviour of MSS by being enabled/disabled which is achieved by commenting out a <CODE>#define</CODE> statement, or leaving it uncommented.</P><P>The following options may be configured in `mss.h´:</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4"><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_PTR_SIZE_T</CODE></TD><TD BGCOLOR="#C0C0FF">This option <I>must</I> be defined. It should be defined to an integer type that is large enough to hold the value of a pointer. Default value for this is <CODE>size_t</CODE>.</TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_PRINTF_SIZE_T</CODE></TD><TD BGCOLOR="#C0C0FF">This option <I>must</I> be defined. It should be defined to a type specifyer string constant that will make printf() correctly print an argument of type <CODE>MSS_PTR_SIZE_T</CODE>. (Ex. if <CODE>MSS_PTR_SIZE_T</CODE> is defined to <CODE>unsigned long</CODE> this option should be defined to <CODE>"%lu"</CODE></TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_FUNCTION_MACRO</CODE></TD><TD BGCOLOR="#C0C0FF">This option <I>must</I> be defined. It should be defined to a predefined macro, or a string variable provided by your compiler that represents the name of the function in which itwas found. (Set it to a string constant in case your compiler doesn't provide such a macro, ex. "unknown").(GNU C Uses <CODE>__PRETTY_FUNCTION__</CODE> or <CODE>__FUNCTION__</CODE>), and by default it is defined to <CODE>__PRETTY_FUNCTION__</CODE>. Borland users need to change this to "(unknown function)" or "?" or something, since Borland does not supply such a function macro.</TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_DEFINE_NEW_DELETE_ARRAY</CODE></TD><TD BGCOLOR="#C0C0FF">Some compiler needs a redefinition of new[] and delete[], some don't (these should be rare nowadays). If your compiler does, define this, otherwise don't (comment it out). GCC wants this defined, whereas Microsoft Visual C++ 1.5 does not.<BR>If you do not know wether or not your compiler wants this defined, try compiling with this option enabled first, and disable it only if it doesn't work.</TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_USE_EXCEPTIONS</CODE></TD><TD BGCOLOR="#C0C0FF">This should be defined if your compiler supports exceptions.If you get a warning/error about operator delete throwing diffrentexceptions (or something like that) try toggeling this, that should help. (GCC 2.8.0 supportsexceptions and wants this enabled, earlier versions does not.(With PGCC-2.90.23 based on EGCS 1.0.1 this should be defined).Anyway, if you get the errors above, try undefining this if defined, anddefining it if undefined. (If you're not compiling with C++ support, you don't need to worry about this).</TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_DTOR_AFTER_ATEXIT</CODE></TD><TD BGCOLOR="#C0C0FF">This option should be defined in case your compiler will runthe destructors of global objects <I>after</I> any functions registered with theatexit() function. It is not essential that this setting is correct for MSS to work, but it will make the logfile look nicer. If your compiler is advanced enough to follow the C++ standard that says that any "exit functions", including <EM>both</EM> destructors of global objects <EM>and</EM> functions registered with atexit should be called in the reverse order that they were registered, i.e. they will be mixed. In that case you will just have to test by toggling this option and see what gives the nicest looking result. Remember, whatever setting you choose for this option, it will <EM>never</EM> lead to a sever error or crash.</TD></TR><TR VALIGN="top"><TD BGCOLOR="#FFC0C0"><CODE>MSS_DISABLE_THREADING_FUNC<BR>MSS_ENABLE_THREADING_FUNC</CODE></TD><TD BGCOLOR="#C0C0FF">These options <EM>must</EM> be defined. They are useful in multithreading environments. They should point to a function disabling respectively enabling threading. This is not a very good solution, and it is likely to change in the future, but at present it's all there is to make the program threading safe. These are defined to nothing by default.</TD></TR></TABLE><P> </P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="compiling-and-installing-mss-using-gcc"><B>2.3 Compiling and installing MSS using GCC</B></A></FONT></FONT></TD></TR></TABLE><P>Since MSS was developed using GCC, and comes with a makefile for GCC, this should not be any problems, unless you use a really old version of GCC. You might however need to configure MSS before compiling, changing one of the <A HREF="#configuring-mss-for-your-compiler">compiler-specific options</A>. </P><P><STRONG>NOTE!</STRONG> If you have GCC but not G++, the GNU C++ compiler, you will want touncomment the 'NOCPP=.' line in the makefile (Remove the '#' sign in front of that line). If you have C++ supporthowever, do not uncomment that line, even if you are only going to use the libraryin plain C projects.</P><P>Enter the MSS directory, and enter 'make all'. This should compileeverything, making the library and test programs.</P><P>If you want to install the package to its default locations which are:<UL><LI>DJGPP: Headerfiles go into %DJDIR%/include, the library goes into %DJDIR%/lib.</LI><LI>LINUX: Headerfiles go into /usr/local/include, the library goes into/usr/local/lib</LI></UL>just enter 'make install'. If you want to install MSS to another location,edit the makefile and change the <CODE>LIBDEST</CODE> and <CODE>INCLUDEDIR</CODE> parameters underthe correct section.</P><A NAME="streambuf.h"><P>If you are using G++ 2.95.x, you have to replace header file <streambuf.h>because of <A HREF="#known-problems">this problem</A>. Just copy %DJDIR%/contrib/mss/streambuf.h to %DJDIR%/lang/cxx/streambuf.h.</P><P>There are a few more rules in this makefile, of which all are listed here.</P><UL><LI><CODE>make all</CODE><BR>This will compile everything both the library and the sample programs.The library will be placed in lib/[linux|djgpp]/libmss.a, and thesample-programs are located in the samples directory. </LI></UL><UL><LI><CODE>make lib</CODE><BR>This will compile the library only.</LI></UL><UL><LI><CODE>make test</CODE><BR>This will compile the test programs, and the library if it is not present.(Same as make all)</LI></UL><UL><LI><CODE>make install</CODE><BR>This will install the library to /usr/local/lib/libmss.a under linux, or%DJDIR%/lib/libmss.a under DJGPP, and the headerfile (`mss.h´) will go in/usr/local/include under linux, and %DJDIR%/include under DJGPP.You can change LIBDEST and INCLUDEDIR in the makefile (under either the DJGPP orlinux section) if you want these files installed to another place, or copy them manually.</LI></UL><UL><LI><CODE>make clean</CODE><BR>This will remove all objectfiles for the specific environment, i.e.if `make clean' is run under Linux it won't remove the DJGPP objectfiles, and vice versa.</LI></UL><UL><LI><CODE>make cleanall</CODE><BR>This will remove all rebuildable files, excluding any installed ones.</LI></UL><UL><LI><CODE>make uninstall</CODE><BR>This will uninstall any installed files, i.e. remove them.</LI></UL></UL><P>MSS comes with a few documented sample programs that will show you some of MSS's capabilities and how you might use MSS to locate bugs. These files are located in the samples directory. See the file <CODE>README</CODE> in that directory for more information.</P><P> </P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="compiling-and-installing-mss-using-borland"><B>2.4 Compiling and installing MSS using Borland C++ 5.02</B></A></FONT></FONT></TD></TR></TABLE><P>The directory MSS was installed to is further called the MSS root directory.Locate <CODE>mss.h</CODE> in the MSS root directory and open it. Comment out the definitionof <CODE>MSS_FUNCTION_MACRO</CODE> and replace it by <CODE>#define MSS_FUNCTION_MACRO "(unknown function)"</CODE>.</P><P><FONT SIZE="+1">Targets in the project file</FONT></P><P>Now open <CODE>borland.ide</CODE> in your IDE. You will notice eight target nodes plus onesource pool node:</P><P><TABLE BORDER="1"><TR><TD><CODE>mss32.lib</CODE></TD><TD>MSS library, no debugging code</TD></TR><TR><TD><CODE>mss32MT.lib</CODE></TD><TD>MSS library, no debugging code, multithreaded*</TD></TR><TR><TD><CODE>mss32debug.lib</CODE></TD><TD>MSS library, with debugging code</TD></TR><TR><TD><CODE>mss32MTdebug.lib </CODE></TD><TD>MSS library, with debugging code, multithreaded*</TD></TR></TABLE></P><P><TABLE BORDER="1"><TR><TD><CODE>test1_1.exe </CODE></TD><TD>MSS test program as included in the MSS relase</TD></TR><TR><TD><CODE>test1_2.exe</CODE></TD><TD>MSS test program as included in the MSS relase</TD></TR><TR><TD><CODE>test1_3.exe</CODE></TD><TD>MSS test program as included in the MSS relase</TD></TR><TR><TD><CODE>test2_1.exe</CODE></TD><TD>MSS test program as included in the MSS relase</TD></TR></TABLE></P><P><TABLE BORDER="1"><TR><TD><CODE>MSSSources </CODE></TD><TD>source pool referenced by all lib targets</TD></TR></TABLE></P><P>All test programs get linked with mss32.lib. I have tested mss32debug.lib, too,but none of the multithreaded libs. Also, I haven't tried to build 16-Bit libs,just in case you might wonder.</P><P>* Please note that you have to modify <CODE>mss.h</CODE> to deal with multithreading. See the<A HREF="#configuring-mss-for-your-compiler">details on MSS_DISABLE_THREADING_FUNC andMSS_ENABLE_THREADING_FUNC</A>. Without that modification, the multithreadedlibraries might not work.</P><P><FONT SIZE="+1">Configuring the project file</FONT></P><P>Under "Options | Project | Directories" adjust the "Include" and "Library" directories so that they match yourenvironment. If you have set an environment variable BCROOT to contain the rootdirectory of your environment, then you don't need to make any modifications.Otherwise you have to replace each occurence of $env(bcroot) by that rootdirectory, e.g. c:\bc5.</P><P><FONT SIZE="+1">Compiling</FONT></P><P>In the MSS root directory, you will have found two subdirectories "lib" and"objs". Each of these directories contain a directory named "borland".These subdirectories will contain the *.obj and *.lib files. (Should you everwant to change these locations, be sure to adjust the "Intermediate" and "Final"directories under Options | Project | Directories accordingly).</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -