TARGET_JVM: ignore failures in Sys.Net
[mono.git] / man / mcs.1
1 .TH mcs 1 "6 January 2001"
2 .SH NAME 
3 mcs, gmcs \- Mono C# Compiler (1.0 and 2.0)
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 
15 .I mcs
16 compiler is used to compile against the 1.x profile and implements
17 C# 1.0 and 2.0 with the exception of generics and nullable types.  The
18 .I gmcs
19 compiler is used to compile against the 2.x profile and implements
20 the complete C# 2.0 specification including generics.
21 .PP
22 The Mono C# compiler accepts the same command line options that the
23 Microsoft C# compiler does.  Those options can start with a slash or a
24 dash (/checked is the same as -checked).  Additionally some GNU-like
25 options are supported, those begin with "--".  All MCS-specific flags
26 which are not available in the Microsoft C# compiler are available
27 only with the GNU-style options.
28 .PP
29 C# source files must end with a ".cs" extension.  Compilation of C#
30 source code requires all the files that make up a library, module or
31 executable to be provided on the command line.  There is no support
32 for partial compilation.  To achieve the benefits of partial
33 compilation, you should compile programs into their own assemblies,
34 and later reference them with the "-r" flag.
35 .PP
36 The Mono C# compiler generates images (.exe files) that contain CIL
37 byte code that can be executed by any system that implements a Common
38 Language Infrastructure virtual machine such as the Microsoft .NET
39 runtime engine on Windows or the Mono runtime engine on Unix systems.
40 Executables are not bound to a specific CPU or operating system.
41 .PP
42 The Mono C# compiler by default only references three assemblies:
43 mscorlib.dll, System.dll and System.Xml.dll.   If you want to
44 reference extra libraries you must manually specify them using the
45 -pkg: command line option or the -r: command line option.
46 Alternatively if you want to get all of the System libraries, you can
47 use the -pkg:dotnet command line option.
48 .PP
49 .SH OPTIONS
50 .TP
51 .I \-\-about
52 Displays information about the Mono C# compiler
53 .TP
54 .I \-\-addmodule:MODULE1[,MODULE2]
55 Includes the specified modules in the resulting assembly.  
56 .TP
57 .I -checked, -checked+
58 Sets the default compilation mode to `checked'.  This makes all
59 the math operations checked (the default is unchecked).
60 .TP
61 .I -checked-
62 Sets the default compilation mode to `unchecked'.  This makes all
63 the math operations unchecked (this is the default).
64 .TP
65 .I -codepage:ID
66 Specifies the code page used to process the input files from the
67 point it is specified on.  By default files will be processed in the
68 Latin-1 code page.  The compiler will also automatically detect
69 Unicode files that have an embedded byte mark at the beginning.   
70 .Sp
71 Other popular encodings are 28591 (Latin1), 1252 (iso-8859-1) and 65001 (UTF-8).
72 .Sp
73 MCS supports a couple of shorthands: "utf8" can be used to specify utf-8 instead
74 of using the cryptic 65001 and "reset" restores the automatic handling of
75 code pages.  These shorthands are not available on the Microsoft compiler.
76 .TP
77 .I \-define:SYMLIST, -d:SYMLIST
78 Defines the symbol listed by the semi-colon separated list SYMLIST
79 SYMBOL.  This can be tested in the source code by the pre-processor,
80 or can be used by methods that have been tagged with the Conditional
81 attribute. 
82 .TP
83 .I \-debug, \-debug+, \-g
84 Generate debugging information.  To obtain stack traces with debugging
85 information, you need to invoke the mono runtime with the `--debug'
86 flag.  This debugging information is stored inside the assembly as a
87 resource.
88 .TP
89 .I \-debug-
90 Do not generate debugging information.
91 .TP
92 .I \-delaysign+
93 Only embed the strongname public key into the assembly. The actual 
94 signing must be done in a later stage using the SN tool. This is useful
95 to protect the private key during development. Note that delay signing
96 can only be done using a strongname key file (not a key container). The
97 option is equivalent to including [assembly: AssemblyDelaySign (true)] 
98 in your source code. Compiler option takes precedence over the 
99 attributes.
100 .TP
101 .I \-delaysign-
102 Default. Strongname (sign) the assembly using the strong name key file
103 (or container). The option is equivalent to including [assembly: 
104 AssemblyDelaySign (false)] in your source code. Compiler option takes
105 precedence over the attributes.
106 .TP
107 .I \-doc:FILE
108 Extracts the C#/XML documentation from the source code and stores in in
109 the given FILE.
110 .TP
111 .I \-\-expect-error X L
112 The compiler will expect the code to generate an error 
113 named `X' in line `L'.  This is only used by the test suite.
114 .TP 
115 .I \-\-fatal 
116 This is used for debugging the compiler.  This makes the error emission
117 generate an exception that can be caught by a debugger.
118 .TP
119 .I \-keyfile:KEYFILE
120 Strongname (sign) the output assembly using the key pair present in 
121 the specified strong name key file (snk). A full key pair is required
122 by default (or when using delaysign-). A file containing only the
123 public key can be used with delaysign+. The option is equivalent to 
124 including [assembly: AssemblyKeyFile ("KEYFILE")] in your source code.
125 Compiler option takes precedence over the attributes.
126 .TP
127 .I \-keycontainer:CONTAINER
128 Strongname (sign) the output assembly using the key pair present in 
129 the specified container. Note that delaysign+ is ignored when using 
130 key containers. The option is equivalent to including [assembly: 
131 AssemblyKeyName ("CONTAINER")] in your source code. Compiler option 
132 takes precedence over the attributes.
133 .TP
134 .I \-langversion:TEXT
135 The option specifies the version of the language to use. The feature
136 set is different in each C# version. This switch can be used to force
137 the compiler to allow only a subset of the features.
138 The possible values are:
139 .RS
140 .ne 8
141 .TP
142 .I "Default"
143 Instruct compiler to use the latest version. Equivalent is to omit the
144 switch (this currently defaults to the C# 2.0 language specification).
145 .TP
146 .I "ISO-1"
147 Restrict compiler to use only ISO standardized features.
148 The usage of features such as generics, static classes, anonymous
149 methods will lead to error.
150 .TP
151 .I "linq"
152 This enables the C# 3.0 support.   Only a few features of C# 3.0 have
153 been implemented in the Mono C# compiler, so not everything is
154 available. 
155 .PP
156 Notice that this flag only controls the language features available to
157 the programmer, it does not control the kind of assemblies produced.
158 Programs compiled with mcs will reference the 1.1 APIs, Programs
159 compiled with gmcs reference the 2.0 APIs.
160 .ne
161 .RE
162 .TP
163 .I -lib:PATHLIST
164 Each path specified in the comma-separated list will direct the
165 compiler to look for libraries in that specified path.
166 .TP
167 .I \-L PATH
168 Directs the compiler to look for libraries in the specified path.
169 Multiple paths can be provided by using the option multiple times.
170 .TP
171 .I \-main:CLASS
172 Tells the compiler which CLASS contains the entry point. Useful when
173 you are compiling several classes with a Main method.
174 .TP
175 .I \-nostdlib, -nostdlib+
176 Use this flag if you want to compile the core library.  This makes the
177 compiler load its internal types from the assembly being compiled.
178 .TP
179 .I \-noconfig, \-noconfig+
180 Disables the default compiler configuration to be loaded.  The
181 compiler by default has references to the system assemblies. 
182 .TP
183 .I \-nowarn:WARNLIST
184 Makes the compiler ignore warnings specified in the comma-separated
185 list WARNLIST>
186 .TP
187 .I -optimize, -optimize+, -optimize-
188 Controls whether to perform optimizations on the code.   -optimize and
189 -optimize+ will turn on optimizations, -optimize- will turn it off.
190 The default in mcs is to optimize+.
191 .TP
192 .I -out:FNAME, -o FNAME
193 Names the output file to be generated.
194 .TP
195 .I \-\-parse
196 Used for benchmarking.  The compiler will only parse its input files.
197 .TP
198 .I \-pkg:package1[,packageN]
199 The compiler will invoke pkg-config --libs on the set of packages
200 specified on the command line to obtain libraries and directories to
201 compile the code.
202 .Sp
203 This is typically used with third party components, like this:
204 .nf
205                 $ mcs -pkg:gtk-sharp demo.cs
206 .fi
207 .TP
208 .TP
209 .I \-pkg:dotnet
210 This will instruct the compiler to reference the System.* libraries
211 available on a typical dotnet framework installation, notice that this
212 does not include all of the Mono libraries, only the System.* ones.  This
213 is a convenient shortcut for those porting code.
214 .TP
215 .I -resource:RESOURCE[,ID]
216 Embeds to the given resource file.  The optional ID can be used to
217 give a different name to the resource.  If not specified, the resource
218 name will be the file name.
219 .TP
220 .I -linkresource:RESOURCE[,ID]
221 Links to the specified RESOURCE.  The optional ID can be used to give
222 a name to the linked resource.
223 .TP
224 .I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
225 Reference the named assemblies.  Use this to use classes from the named
226 assembly in your program.  The assembly will be loaded from either the
227 system directory where all the assemblies live, or from the path
228 explicitly given with the -L option.
229 .PP
230 You can also use a semicolon to separate the assemblies instead of a
231 comma. 
232 .TP
233 .I \-recurse:PATTERN, --recurse PATTERN
234 Does recursive compilation using the specified pattern.  In Unix the
235 shell will perform globbing, so you might want to use it like this:
236 .PP
237 .nf
238                 $ mcs -recurse:'*.cs' 
239 .fi
240 .TP
241 .I \-\-stacktrace
242 Generates a stack trace at the time the error is reported, useful for
243 debugging the compiler.
244 .TP
245 .I \-target:KIND, \-t:KIND
246 Used to specify the desired target.  The possible values are: exe
247 (plain executable), winexe (Windows.Forms executable), library
248 (component libraries) and module (partial library).
249 .TP
250 .I \-\-timestamp
251 Another debugging flag.  Used to display the times at various points
252 in the compilation process.
253 .TP
254 .I \-unsafe, -unsafe+
255 Enables compilation of unsafe code.
256 .TP
257 .I \-v 
258 Debugging. Turns on verbose yacc parsing.
259 .TP
260 .I \-v2
261 Turns on C# 2.0 language features.
262 .TP
263 .I \-\-version
264 Shows the compiler version.
265 .TP
266 .I \-warnaserror, \-warnaserror+
267 Treat warnings as errors.
268 .TP
269 .I \-warn:LEVEL
270 Sets the warning level.  0 is the lowest warning level, and 4 is the
271 highest.  The default is 2.
272 .TP
273 .I \-win32res:FILE
274 Specifies a Win32 resource file (.res) to be bundled into the
275 resulting assembly.
276 .TP
277 .I \-win32icon:FILE
278 Attaches the icon specified in FILE on the output into the resulting
279 assembly.
280 .TP
281 .I \-\-
282 Use this to stop option parsing, and allow option-looking parameters
283 to be passed on the command line.
284 .PP
285 .SH SPECIAL DEFINES
286 The 
287 .B TRACE
288 and
289 .B DEBUG
290 defines have a special meaning to the compiler.
291 .PP
292 By default calls to methods and properties in the
293 System.Diagnostics.Trace class are not generated unless the TRACE
294 symbol is defined (either through a "#define TRACE") in your source
295 code, or by using the
296 .I "--define TRACE"
297 in the command line.
298 .PP
299 By default calls to methods and properties in the
300 System.Diagnostics.Debug class are not generated unless the DEBUG
301 symbol is defined (either through a "#define DEBUG") in your source
302 code, or by using the
303 .I "--define DEBUG"
304 in the command line.
305 .PP
306 Note that the effect of defining TRACE and DEBUG is a global setting,
307 even if they are only defined in a single file.
308 .PP
309 .SH DEBUGGING SUPPORT
310 When use the "--debug" or "-g" flag, MCS will create an assembler file
311 FILE-debug.s containing debugging information where FILE is the name of
312 the generated assembly. You need to run this file through the assembler
313 to get a object file FILE-debug.o.  See mono's "--dwarf-plus" argument
314 for details on how to use this file.
315 .SH NOTES
316 During compilation the MCS compiler defines the __MonoCS__ symbol,
317 this can be used by pre-processor instructions to compile Mono C#
318 compiler specific code.   Please note that this symbol is only to test
319 for the compiler, and is not useful to distinguish compilation or
320 deployment platforms.
321 .SH AUTHORS
322 The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap,
323 Martin Baulig, Marek Safar and Raja Harinath.  The development was
324 funded by Ximian, Novell and Marek Safar.
325 .PP
326 .SH LICENSE
327 The Mono Compiler Suite is released under the terms of the GNU GPL.
328 Please read the accompanying `COPYING' file for details.  Alternative
329 licensing for the compiler is available from Novell.
330 .PP
331 .SH SEE ALSO
332 mono(1), mint(1), sn(1)
333 .PP
334 .SH BUGS
335 To report bugs in the compiler, you must file them on our bug tracking
336 system, at:
337 http://www.mono-project.com/Bugs 
338 .SH MAILING LIST
339 The Mono Mailing lists are listed at http://www.mono-project.com/Mailing_Lists
340 .SH MORE INFORMATION
341 The Mono C# compiler was developed by Novell, Inc
342 (http://www.novell.com, http) and is based on the
343 ECMA C# language standard available here:
344 http://www.ecma.ch/ecma1/STAND/ecma-334.htm
345 .PP
346 The home page for the Mono C# compiler is at http://www.mono-project.com/CSharp_Compiler