31b1350d54c31651df9ce32c9ab5b0a118548329
[mono.git] / man / mcs.1
1 .TH mcs 1 "6 January 2001"
2 .SH NAME 
3 mcs \- Mono Compiler Suite.
4 .SH SYNOPSIS
5 .B mcs 
6 [option] [source-files]
7 .SH DESCRIPTION
8 mcs is the Mono C# compiler, an implementation of the ECMA-334
9 language specification.  You can pass one or more options to drive the
10 compiler, and a set of source files.  Extra options or arguments can
11 be provided in a response file.  Response files are referenced by
12 prepending the @ symbol to the response file name.
13 .PP
14 The Mono C# compiler accepts the same options than the Microsoft C#
15 compiler does.  Those options can start with a slash or a dash
16 (/checked is the same as -checked).  Additionally to this, the
17 GNU-like options are supported, those begin with "--".  All
18 MCS-specific flags which are not available in the Microsoft C#
19 compiler are available only with the GNU-style options. 
20 .PP
21 C# source files must end with a ".cs" extension.  Compilation of C#
22 source code requires all the files that make up a library, module or
23 executable to be provided on the command line.  There is no support
24 for partial compilation.  To achieve the benefits of partial
25 compilation, you should compile programs into their own assemblies,
26 and later reference them with the "-r" flag.
27 .PP
28 The Mono C# compiler generates images (.exe files) that contain CIL
29 byte code that can be executed by any system that implements a Common
30 Language Infrastructure virtual machine such as the Microsoft .NET
31 runtime engine on Windows or the Mono runtime engine on Unix systems.
32 Executables are not bound to a specific CPU or operating system.
33 .PP
34 .SH OPTIONS
35 .TP
36 .I \-\-about
37 Displays information about the Mono C# compiler
38 .TP
39 .I \-\-addmodule:MODULE1[,MODULE2]
40 Includes the specified modules in the resulting assembly.  
41 .TP
42 .I -checked, -checked+
43 Sets the default compilation mode to `checked'.  This makes all
44 the math operations checked (the default is unchecked).
45 .TP
46 .I -checked-
47 Sets the default compilation mode to `unchecked'.  This makes all
48 the math operations unchecked (this is the default).
49 .TP
50 .I -codepage:ID
51 Specifies the code page used to process the input files from the
52 point it is specified on.  By default files will be processed in the
53 Latin-1 code page.  The compiler will also automatically detect
54 Unicode files that have an embedded byte mark at the beginning.   The
55 special ID "utf8" can be used to switch to utf8 and the ID "reset"
56 restores the automatic handling of code pages.
57 .TP
58 .I \-define:SYMLIST, -d:SYMLIST
59 Defines the symbol listed by the semi-colon separeted list SYMLIST
60 SYMBOL.  This can be tested in the source code by the pre-processor,
61 or can be used by methods that have been tagged with the Conditional
62 attribute. 
63 .TP
64 .I \-debug, \-debug+, \-g
65 Generate debugging information.  To obtain stack traces with debugging
66 information, you need to invoke the mono runtime with the `--debug'
67 flag.  This debugging information is stored inside the assembly as a
68 resource.
69 .TP
70 .I \-debug-
71 Do not generate debugging information.
72 .TP
73 .I \-\-expect-error X L
74 The compiler will expect the code to generate an error 
75 named `X' in line `L'.  This is only used by the test suite.
76 .TP 
77 .I \-\-fatal 
78 This is used for debugging the compiler.  This makes the error emission
79 generate an exception that can be caught by a debugger.
80 .TP
81 .I \-\-stacktrace
82 Generates a stack trace at the time the error is reported, useful for
83 debugging the compiler.
84 .TP
85 .I -lib:PATHLIST
86 Each path specified in the comma-separated list will direct the
87 compiler to look for libraries in that specified path.
88 .TP
89 .I \-L PATH
90 Directs the compiler to look for libraries in the specified path.
91 Multiple paths can be provided by using the option multiple times.
92 .TP
93 .I \-nostdlib, -nostdlib+
94 Use this flag if you want to compile the core library.  This makes the
95 compiler load its internal types from the assembly being compiled.
96 .TP
97 .I \-noconfig, \-noconfig+
98 Disables the default compiler configuration to be loaded.  The
99 compiler by default has references to the system assemblies. 
100 .TP
101 .I \-nowarn:WARNLIST
102 Makes the compiler ignore warnings specified in the comma-separeted
103 list WARNLIST>
104 .TP
105 .I -out:FNAME, -o FNAME
106 Names the output file to be generated.
107 .TP
108 .I \-\-parse
109 Used for benchmarking.  The compiler will only parse its input files.
110 .TP
111 .I -resource:RESOURCE[,ID]
112 Embeds to the given resource file.  The optional ID can be used to
113 give a different name to the resource.  If not specified, the resource
114 name will be the file name.
115 .TP
116 .I -linkresource:RESOURCE[,ID]
117 Links to the specified RESOURCE.  The optional ID can be used to give
118 a name to the linked resource.
119 .TP
120 .I \-recurse:PATTERN, --recurse PATTERN
121 Does recursive compilation using the specified pattern.  In Unix the
122 shell will perform globbing, so you migth want to use it like this:
123 .PP
124 .nf
125                 bash$ mcs -recurse:'*.cs' 
126 .fi
127 .TP
128 .I \-target:KIND, \-t:KIND
129 Used to specify the desired target.  The possible values are: exe
130 (plain executable), winexe (Windows.Forms executable), library
131 (component libraries) and module (partial library).
132 .TP
133 .I \-\-timestamp
134 Another debugging flag.  Used to display the times at various points
135 in the compilation process.
136 .TP
137 .I \-unsafe, -unsafe+
138 Enables compilation of unsafe code.
139 .TP
140 .I \-warnaserror, \-warnaserror+
141 Treat warnings as errors.
142 .TP
143 .I \-warn:LEVEL
144 Sets the warning level.  0 is the lowest warning level, and 4 is the
145 highest.  The default is 2.
146 .TP
147 .I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
148 Reference the named assemblies.  Use this to use classes from the named
149 assembly in your program.  The assembly will be loaded from either the
150 system directory where all the assemblies live, or from the path
151 explicitly given with the -L option.
152 .PP
153 You can also use a semicolon to separate the assemblies instead of a
154 comma. 
155 .TP
156 .I \-v 
157 Debugging. Turns on verbose yacc parsing.
158 .TP
159 .I \-v2
160 Turns on C# 2.0 language features.
161 .TP
162 .I \-\-version
163 Shows the compiler version.
164 .TP
165 .I \-\-
166 Use this to stop option parsing, and allow option-looking parameters
167 to be passed on the command line.
168 .PP
169 .SH SPECIAL DEFINES
170 The 
171 .B TRACE
172 and
173 .B DEBUG
174 defines have a special meaning to the compiler.
175 .PP
176 By default calls to methods and properties in the
177 System.Diagnostics.Trace class are not generated unless the TRACE
178 symbol is defined (either through a "#define TRACE") in your source
179 code, or by using the
180 .I "--define TRACE"
181 in the command line.
182 .PP
183 By default calls to methods and properties in the
184 System.Diagnostics.Debug class are not generated unless the DEBUG
185 symbol is defined (either through a "#define DEBUG") in your source
186 code, or by using the
187 .I "--define DEBUG"
188 in the command line.
189 .PP
190 Note that the effect of defining TRACE and DEBUG is a global setting,
191 even if they are only defined in a single file.
192 .PP
193 .SH DEBUGGING SUPPORT
194 When use the "--debug" or "-g" flag, MCS will create an assembler file
195 FILE-debug.s containing debugging information where FILE is the name of
196 the generated assembly. You need to run this file through the assembler
197 to get a object file FILE-debug.o.  See mono's "--dwarf-plus" argument
198 for details on how to use this file.
199 .SH NOTES
200 During compilation the MCS compiler defines the __MonoCS__ symbol,
201 this can be used by pre-processor instructions to compile Mono C#
202 compiler specific code.   Please note that this symbol is only to test
203 for the compiler, and is not useful to distinguish compilation or
204 deployment platforms.
205 .SH AUTHORS
206 The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap and
207 Martin Baulig at Ximian.
208 .PP
209 .SH LICENSE
210 The Mono Compiler Suite is released under the terms of the GNU GPL.
211 Please read the accompanying `COPYING' file for details.  Alternative
212 licenses are available from Ximian.
213 .PP
214 .SH SEE ALSO
215 mono(1), mint(1)
216 .PP
217 .SH BUGS
218 To report bugs in the compiler, you can use `bug-buddy', or you can
219 file bug reports in our bug tracking system:
220 http://bugzilla.ximian.com.
221 .SH MAILING LIST
222 The Mono Mailing List is available at: mono-list-request@ximian.com
223 .SH MORE INFORMATION
224 The Mono C# compiler is developed by Ximian, Inc
225 (http://www.ximian.com) (http://www.ximian.com) and is based on the
226 ECMA C# language standard available here:
227 http://www.ecma.ch/ecma1/STAND/ecma-334.htm
228
229