2004-04-02 Zoltan Varga <vargaz@freemail.hu>
[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 \-delaysign+
74 Only embed the strongname public key into the assembly. The actual 
75 signing must be done in a later stage using the SN tool. This is useful
76 to protect the private key during development. Note that delay signing
77 can only be done using a strongname key file (not a key container). The
78 option is equivalent to including [assembly: AssemblyDelaySign (true)] 
79 in your source code. Compiler option takes precedence over the 
80 attributes.
81 .TP
82 .I \-delaysign-
83 Default. Strongname (sign) the assembly using the strong name key file
84 (or container). The option is equivalent to including [assembly: 
85 AssemblyDelaySign (false)] in your source code. Compiler option takes
86 precedence over the attributes.
87 .TP
88 .I \-\-expect-error X L
89 The compiler will expect the code to generate an error 
90 named `X' in line `L'.  This is only used by the test suite.
91 .TP 
92 .I \-\-fatal 
93 This is used for debugging the compiler.  This makes the error emission
94 generate an exception that can be caught by a debugger.
95 .TP
96 .I \-keyfile:KEYFILE
97 Strongname (sign) the output assembly using the key pair present in 
98 the specified strong name key file (snk). A full key pair is required
99 by default (or when using delaysign-). A file containing only the
100 public key can be used with delaysign+. The option is equivalent to 
101 including [assembly: AssemblyKeyFile ("KEYFILE")] in your source code.
102 Compiler option takes precedence over the attributes.
103 .TP
104 .I \-keycontainer:CONTAINER
105 Strongname (sign) the output assembly using the key pair present in 
106 the specified container. Note that delaysign+ is ignored when using 
107 key containers. The option is equivalent to including [assembly: 
108 AssemblyKeyName ("CONTAINER")] in your source code. Compiler option 
109 takes precedence over the attributes.
110 .TP
111 .I \-\-stacktrace
112 Generates a stack trace at the time the error is reported, useful for
113 debugging the compiler.
114 .TP
115 .I -lib:PATHLIST
116 Each path specified in the comma-separated list will direct the
117 compiler to look for libraries in that specified path.
118 .TP
119 .I \-L PATH
120 Directs the compiler to look for libraries in the specified path.
121 Multiple paths can be provided by using the option multiple times.
122 .TP
123 .I \-nostdlib, -nostdlib+
124 Use this flag if you want to compile the core library.  This makes the
125 compiler load its internal types from the assembly being compiled.
126 .TP
127 .I \-noconfig, \-noconfig+
128 Disables the default compiler configuration to be loaded.  The
129 compiler by default has references to the system assemblies. 
130 .TP
131 .I \-nowarn:WARNLIST
132 Makes the compiler ignore warnings specified in the comma-separeted
133 list WARNLIST>
134 .TP
135 .I -out:FNAME, -o FNAME
136 Names the output file to be generated.
137 .TP
138 .I \-\-parse
139 Used for benchmarking.  The compiler will only parse its input files.
140 .TP
141 .I -resource:RESOURCE[,ID]
142 Embeds to the given resource file.  The optional ID can be used to
143 give a different name to the resource.  If not specified, the resource
144 name will be the file name.
145 .TP
146 .I -linkresource:RESOURCE[,ID]
147 Links to the specified RESOURCE.  The optional ID can be used to give
148 a name to the linked resource.
149 .TP
150 .I -r:ASSEMBLY1[,ASSEMBLY2], \-r ASSEMBLY1[,ASSEMBLY2]
151 Reference the named assemblies.  Use this to use classes from the named
152 assembly in your program.  The assembly will be loaded from either the
153 system directory where all the assemblies live, or from the path
154 explicitly given with the -L option.
155 .PP
156 You can also use a semicolon to separate the assemblies instead of a
157 comma. 
158 .TP
159 .I \-recurse:PATTERN, --recurse PATTERN
160 Does recursive compilation using the specified pattern.  In Unix the
161 shell will perform globbing, so you migth want to use it like this:
162 .PP
163 .nf
164                 bash$ mcs -recurse:'*.cs' 
165 .fi
166 .TP
167 .I \-target:KIND, \-t:KIND
168 Used to specify the desired target.  The possible values are: exe
169 (plain executable), winexe (Windows.Forms executable), library
170 (component libraries) and module (partial library).
171 .TP
172 .I \-\-timestamp
173 Another debugging flag.  Used to display the times at various points
174 in the compilation process.
175 .TP
176 .I \-unsafe, -unsafe+
177 Enables compilation of unsafe code.
178 .TP
179 .I \-v 
180 Debugging. Turns on verbose yacc parsing.
181 .TP
182 .I \-v2
183 Turns on C# 2.0 language features.
184 .TP
185 .I \-\-version
186 Shows the compiler version.
187 .TP
188 .I \-warnaserror, \-warnaserror+
189 Treat warnings as errors.
190 .TP
191 .I \-warn:LEVEL
192 Sets the warning level.  0 is the lowest warning level, and 4 is the
193 highest.  The default is 2.
194 .TP
195 .I \-win32res:FILE
196 Specifies a Win32 resource file (.res) to be bundled into the
197 resulting assembly.
198 .TP
199 .I \-win32icon:FILE
200 Attaches the icon specified in FILE on the output into the resulting
201 assembly.
202 .TP
203 .I \-\-
204 Use this to stop option parsing, and allow option-looking parameters
205 to be passed on the command line.
206 .PP
207 .SH SPECIAL DEFINES
208 The 
209 .B TRACE
210 and
211 .B DEBUG
212 defines have a special meaning to the compiler.
213 .PP
214 By default calls to methods and properties in the
215 System.Diagnostics.Trace class are not generated unless the TRACE
216 symbol is defined (either through a "#define TRACE") in your source
217 code, or by using the
218 .I "--define TRACE"
219 in the command line.
220 .PP
221 By default calls to methods and properties in the
222 System.Diagnostics.Debug class are not generated unless the DEBUG
223 symbol is defined (either through a "#define DEBUG") in your source
224 code, or by using the
225 .I "--define DEBUG"
226 in the command line.
227 .PP
228 Note that the effect of defining TRACE and DEBUG is a global setting,
229 even if they are only defined in a single file.
230 .PP
231 .SH DEBUGGING SUPPORT
232 When use the "--debug" or "-g" flag, MCS will create an assembler file
233 FILE-debug.s containing debugging information where FILE is the name of
234 the generated assembly. You need to run this file through the assembler
235 to get a object file FILE-debug.o.  See mono's "--dwarf-plus" argument
236 for details on how to use this file.
237 .SH NOTES
238 During compilation the MCS compiler defines the __MonoCS__ symbol,
239 this can be used by pre-processor instructions to compile Mono C#
240 compiler specific code.   Please note that this symbol is only to test
241 for the compiler, and is not useful to distinguish compilation or
242 deployment platforms.
243 .SH AUTHORS
244 The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap and
245 Martin Baulig at Ximian.
246 .PP
247 .SH LICENSE
248 The Mono Compiler Suite is released under the terms of the GNU GPL.
249 Please read the accompanying `COPYING' file for details.  Alternative
250 licenses are available from Ximian.
251 .PP
252 .SH SEE ALSO
253 mono(1), mint(1), sn(1)
254 .PP
255 .SH BUGS
256 To report bugs in the compiler, you can use `bug-buddy', or you can
257 file bug reports in our bug tracking system:
258 http://bugzilla.ximian.com.
259 .SH MAILING LIST
260 The Mono Mailing List is available at: mono-list-request@ximian.com
261 .SH MORE INFORMATION
262 The Mono C# compiler is developed by Ximian, Inc
263 (http://www.ximian.com) (http://www.ximian.com) and is based on the
264 ECMA C# language standard available here:
265 http://www.ecma.ch/ecma1/STAND/ecma-334.htm
266
267