GenericParameter.cs: override Module properly
[mcs.git] / tools / monodoc / Test / man-test1.html
blob305a3f8d0f56ea70147763fb8c81f9896757365d
1 <table width="100%" bgcolor="#b0c4da"><tr colspan="2"><td>Manual Pages</td></tr>
2 <tr><td><h3>mcs(1)</h3></td><td align="right">6 January 2001</td></tr></table>
3 <h2>NAME </h2><blockquote>
4 mcs, gmcs, smcs - Mono C# Compiler (1.0, 2.0, Moonlight)
5 </blockquote><h2>SYNOPSIS</h2><blockquote>
6 <b>mcs </b>
7 [option] [source-files]
8 </blockquote><h2>DESCRIPTION</h2><blockquote>
9 mcs is the Mono C# compiler, an implementation of the ECMA-334
10 language specification. You can pass one or more options to drive the
11 compiler, and a set of source files. Extra options or arguments can
12 be provided in a response file. Response files are referenced by
13 prepending the @ symbol to the response file name.
14 <p>
15 The
16 <i>mcs</i>
17 compiler is used to compile against the 1.x profile and implements
18 C# 1.0 and 2.0 with the exception of generics and nullable types.
19 </p><p>
20 The
21 <i>gmcs</i>
22 compiler is used to compile against the 2.0 profile and implements
23 the complete C# 2.0 specification including generics.
24 </p><p>
25 The
26 <i>smcs</i>
27 compiler is used to compile against the Silverlight/Moonlight profile.
28 This profile is designed to be used for creating Silverlight/Moonlight
29 applications that will run on a web browser. The API exposed by this
30 profile is a small subset of the 2.0 API (even if it is commonly
31 referred as the 2.1 API, this API is a small subset of 2.0 with a few
32 extensions), in addition this profile by default runs with
33 -langversion:linq which turns on the C# 3.0 language by default.
34 </p><p>
35 The Mono C# compiler accepts the same command line options that the
36 Microsoft C# compiler does. Those options can start with a slash or a
37 dash (/checked is the same as -checked). Additionally some GNU-like
38 options are supported, those begin with "--". All MCS-specific flags
39 which are not available in the Microsoft C# compiler are available
40 only with the GNU-style options.
41 </p><p>
42 C# source files must end with a ".cs" extension. Compilation of C#
43 source code requires all the files that make up a library, module or
44 executable to be provided on the command line. There is no support
45 for partial compilation. To achieve the benefits of partial
46 compilation, you should compile programs into their own assemblies,
47 and later reference them with the "-r" flag.
48 </p><p>
49 The Mono C# compiler generates images (.exe files) that contain CIL
50 byte code that can be executed by any system that implements a Common
51 Language Infrastructure virtual machine such as the Microsoft .NET
52 runtime engine on Windows or the Mono runtime engine on Unix systems.
53 Executables are not bound to a specific CPU or operating system.
54 </p><p>
55 The Mono C# compiler by default only references three assemblies:
56 mscorlib.dll, System.dll and System.Xml.dll. If you want to
57 reference extra libraries you must manually specify them using the
58 -pkg: command line option or the -r: command line option.
59 Alternatively if you want to get all of the System libraries, you can
60 use the -pkg:dotnet command line option.
61 </p><p>
62 </p></blockquote><h2>OPTIONS</h2><blockquote>
63 <dl><dt>
64 <i>--about</i></dt><dd>
65 Displays information about the Mono C# compiler
66 </dd><dt>
67 <i>--addmodule:MODULE1[,MODULE2]</i></dt><dd>
68 Includes the specified modules in the resulting assembly.
69 </dd><dt>
70 <i>-checked, -checked+</i></dt><dd>
71 Sets the default compilation mode to `checked'. This makes all
72 the math operations checked (the default is unchecked).
73 </dd><dt>
74 <i>-checked-</i></dt><dd>
75 Sets the default compilation mode to `unchecked'. This makes all
76 the math operations unchecked (this is the default).
77 </dd><dt>
78 <i>-codepage:ID</i></dt><dd>
79 Specifies the code page used to process the input files from the
80 point it is specified on. By default files will be processed in the
81 environment-dependent native code page. The compiler will also automatically
82 detect Unicode files that have an embedded byte mark at the beginning.
83 <p>
84 Other popular encodings are 28591 (Latin1), 1252 (iso-8859-1) and 65001 (UTF-8).
85 </p><p>
86 MCS supports a couple of shorthands: "utf8" can be used to specify utf-8 instead
87 of using the cryptic 65001 and "reset" restores the automatic handling of
88 code pages. These shorthands are not available on the Microsoft compiler.
89 </p></dd><dt>
90 <i>-define:SYMLIST, -d:SYMLIST</i></dt><dd>
91 Defines the symbol listed by the semi-colon separated list SYMLIST
92 SYMBOL. This can be tested in the source code by the pre-processor,
93 or can be used by methods that have been tagged with the Conditional
94 attribute.
95 </dd><dt>
96 <i>-debug, -debug+, -g</i></dt><dd>
97 Generate debugging information. To obtain stack traces with debugging
98 information, you need to invoke the mono runtime with the `--debug'
99 flag. This debugging information is stored inside the assembly as a
100 resource.
101 </dd><dt>
102 <i>-debug-</i></dt><dd>
103 Do not generate debugging information.
104 </dd><dt>
105 <i>-delaysign+</i></dt><dd>
106 Only embed the strongname public key into the assembly. The actual
107 signing must be done in a later stage using the SN tool. This is useful
108 to protect the private key during development. Note that delay signing
109 can only be done using a strongname key file (not a key container). The
110 option is equivalent to including [assembly: AssemblyDelaySign (true)]
111 in your source code. Compiler option takes precedence over the
112 attributes.
113 </dd><dt>
114 <i>-delaysign-</i></dt><dd>
115 Default. Strongname (sign) the assembly using the strong name key file
116 (or container). The option is equivalent to including [assembly:
117 AssemblyDelaySign (false)] in your source code. Compiler option takes
118 precedence over the attributes.
119 </dd><dt>
120 <i>-doc:FILE</i></dt><dd>
121 Extracts the C#/XML documentation from the source code and stores in in
122 the given FILE.
123 </dd><dt>
124 <i>--expect-error X L</i></dt><dd>
125 The compiler will expect the code to generate an error
126 named `X' in line `L'. This is only used by the test suite.
127 </dd><dt>
128 <i>--fatal </i></dt><dd>
129 This is used for debugging the compiler. This makes the error emission
130 generate an exception that can be caught by a debugger.
131 </dd><dt>
132 <i>-keyfile:KEYFILE</i></dt><dd>
133 Strongname (sign) the output assembly using the key pair present in
134 the specified strong name key file (snk). A full key pair is required
135 by default (or when using delaysign-). A file containing only the
136 public key can be used with delaysign+. The option is equivalent to
137 including [assembly: AssemblyKeyFile ("KEYFILE")] in your source code.
138 Compiler option takes precedence over the attributes.
139 </dd><dt>
140 <i>-keycontainer:CONTAINER</i></dt><dd>
141 Strongname (sign) the output assembly using the key pair present in
142 the specified container. Note that delaysign+ is ignored when using
143 key containers. The option is equivalent to including [assembly:
144 AssemblyKeyName ("CONTAINER")] in your source code. Compiler option
145 takes precedence over the attributes.
146 </dd><dt>
147 <i>-langversion:TEXT</i></dt><dd>
148 The option specifies the version of the language to use. The feature
149 set is different in each C# version. This switch can be used to force
150 the compiler to allow only a subset of the features.
151 The possible values are:
152 <blockquote>
154 <dl><dt>
155 <i>Default</i></dt><dd>
156 Instruct compiler to use the latest version. Equivalent is to omit the
157 switch (this currently defaults to the C# 2.0 language specification).
158 </dd><dt>
159 <i>ISO-1</i></dt><dd>
160 Restrict compiler to use only first ISO standardized features.
161 The usage of features such as generics, static classes, anonymous
162 methods will lead to error.
163 </dd><dt>
164 <i>ISO-2</i></dt><dd>
165 Restrict compiler to use only the second ISO standardized features.
166 This allows the use of generics, static classes, iterators and
167 anonymous methods for example.
168 </dd><dt>
169 <i>linq</i></dt><dd>
170 This enables the C# 3.0 support. Only a few features of C# 3.0 have
171 been implemented in the Mono C# compiler, so not everything is
172 available.
173 </dd></dl><p>
174 Notice that this flag only controls the language features available to
175 the programmer, it does not control the kind of assemblies produced.
176 Programs compiled with mcs will reference the 1.1 APIs, Programs
177 compiled with gmcs reference the 2.0 APIs.
179 </p></blockquote>
180 </dd><dt>
181 <i>-lib:PATHLIST</i></dt><dd>
182 Each path specified in the comma-separated list will direct the
183 compiler to look for libraries in that specified path.
184 </dd><dt>
185 <i>-L PATH</i></dt><dd>
186 Directs the compiler to look for libraries in the specified path.
187 Multiple paths can be provided by using the option multiple times.
188 </dd><dt>
189 <i>-main:CLASS</i></dt><dd>
190 Tells the compiler which CLASS contains the entry point. Useful when
191 you are compiling several classes with a Main method.
192 </dd><dt>
193 <i>-nostdlib, -nostdlib+</i></dt><dd>
194 Use this flag if you want to compile the core library. This makes the
195 compiler load its internal types from the assembly being compiled.
196 </dd><dt>
197 <i>-noconfig, -noconfig+</i></dt><dd>
198 Disables the default compiler configuration to be loaded. The
199 compiler by default has references to the system assemblies.
200 </dd><dt>
201 <i>-nowarn:WARNLIST</i></dt><dd>
202 Makes the compiler ignore warnings specified in the comma-separated
203 list WARNLIST&gt;
204 </dd><dt>
205 <i>-optimize, -optimize+, -optimize-</i></dt><dd>
206 Controls whether to perform optimizations on the code. -optimize and
207 -optimize+ will turn on optimizations, -optimize- will turn it off.
208 The default in mcs is to optimize+.
209 </dd><dt>
210 <i>-out:FNAME, -o FNAME</i></dt><dd>
211 Names the output file to be generated.
212 </dd><dt>
213 <i>--parse</i></dt><dd>
214 Used for benchmarking. The compiler will only parse its input files.
215 </dd><dt>
216 <i>-pkg:package1[,packageN]</i></dt><dd>
217 Reference assemblies for the given packages.
219 The compiler will invoke pkg-config --libs on the set of packages
220 specified on the command line to obtain libraries and directories to
221 compile the code.
222 </p><p>
223 This is typically used with third party components, like this:
224 </p><pre>
227 $ mcs -pkg:gtk-sharp demo.cs
228 </pre>
229 <blockquote>
231 <dl><dt>
232 <i>-pkg:dotnet</i></dt><dd>
233 This will instruct the compiler to reference the System.* libraries
234 available on a typical dotnet framework installation, notice that this
235 does not include all of the Mono libraries, only the System.* ones. This
236 is a convenient shortcut for those porting code.
237 </dd><dt>
238 <i>-pkg:olive</i></dt><dd>
239 Use this to reference the "Olive" libraries (the 3.0 and 3.5 extended
240 libraries).
241 </dd><dt>
242 <i>-pkg:silver</i></dt><dd>
243 References the assemblies for creating Moonlight/Silverlight
244 applications. This is automatically used when using the
245 <i>smcs </i>
246 compiler, but it is here when developers want to use it with the
247 <i>gmcs</i>
248 compiler.
249 </dd><dt>
250 <i>-pkg:silverdesktop</i></dt><dd>
251 Use this option to create Moonlight/Silverlight applications that
252 target the desktop. This option allows developers to consume the
253 Silverlight APIs with the full 2.0 profile API available to them,
254 unlike
255 <i>smcs </i>
256 it gives full access to all the APIs that are part of Mono. The only
257 downside is that applications created with silverdesktop will not run
258 on the browser. Typically these applications will be launched
259 with the
260 <i>mopen</i>
261 command line tool.
263 </dd></dl></blockquote>
264 </dd><dt>
265 <i>-resource:RESOURCE[,ID]</i></dt><dd>
266 Embeds to the given resource file. The optional ID can be used to
267 give a different name to the resource. If not specified, the resource
268 name will be the file name.
269 </dd><dt>
270 <i>-linkresource:RESOURCE[,ID]</i></dt><dd>
271 Links to the specified RESOURCE. The optional ID can be used to give
272 a name to the linked resource.
273 </dd><dt>
274 <i>-r:ASSEMBLY1[,ASSEMBLY2], -r ASSEMBLY1[,ASSEMBLY2]</i></dt><dd>
275 Reference the named assemblies. Use this to use classes from the named
276 assembly in your program. The assembly will be loaded from either the
277 system directory where all the assemblies live, or from the path
278 explicitly given with the -L option.
279 </dd></dl><p>
280 You can also use a semicolon to separate the assemblies instead of a
281 comma.
282 </p><dl><dt>
283 <i>-recurse:PATTERN, --recurse PATTERN</i></dt><dd>
284 Does recursive compilation using the specified pattern. In Unix the
285 shell will perform globbing, so you might want to use it like this:
286 </dd></dl><p>
287 </p><pre>
289 $ mcs -recurse:'*.cs'
290 </pre>
291 <dl><dt>
292 <i>--stacktrace</i></dt><dd>
293 Generates a stack trace at the time the error is reported, useful for
294 debugging the compiler.
295 </dd><dt>
296 <i>-target:KIND, -t:KIND</i></dt><dd>
297 Used to specify the desired target. The possible values are: exe
298 (plain executable), winexe (Windows.Forms executable), library
299 (component libraries) and module (partial library).
300 </dd><dt>
301 <i>--timestamp</i></dt><dd>
302 Another debugging flag. Used to display the times at various points
303 in the compilation process.
304 </dd><dt>
305 <i>-unsafe, -unsafe+</i></dt><dd>
306 Enables compilation of unsafe code.
307 </dd><dt>
308 <i>-v </i></dt><dd>
309 Debugging. Turns on verbose yacc parsing.
310 </dd><dt>
311 <i>-v2</i></dt><dd>
312 Turns on C# 2.0 language features.
313 </dd><dt>
314 <i>--version</i></dt><dd>
315 Shows the compiler version.
316 </dd><dt>
317 <i>-warnaserror, -warnaserror+</i></dt><dd>
318 Treat warnings as errors.
319 </dd><dt>
320 <i>-warn:LEVEL</i></dt><dd>
321 Sets the warning level. 0 is the lowest warning level, and 4 is the
322 highest. The default is 2.
323 </dd><dt>
324 <i>-win32res:FILE</i></dt><dd>
325 Specifies a Win32 resource file (.res) to be bundled into the
326 resulting assembly.
327 </dd><dt>
328 <i>-win32icon:FILE</i></dt><dd>
329 Attaches the icon specified in FILE on the output into the resulting
330 assembly.
331 </dd><dt>
332 <i>--</i></dt><dd>
333 Use this to stop option parsing, and allow option-looking parameters
334 to be passed on the command line.
335 </dd></dl><p>
336 </p></blockquote><h2>SPECIAL DEFINES</h2><blockquote>
337 The
338 <b>TRACE</b>
340 <b>DEBUG</b>
341 defines have a special meaning to the compiler.
343 By default calls to methods and properties in the
344 System.Diagnostics.Trace class are not generated unless the TRACE
345 symbol is defined (either through a "#define TRACE") in your source
346 code, or by using the
347 <i>--define TRACE</i>
348 in the command line.
349 </p><p>
350 By default calls to methods and properties in the
351 System.Diagnostics.Debug class are not generated unless the DEBUG
352 symbol is defined (either through a "#define DEBUG") in your source
353 code, or by using the
354 <i>--define DEBUG</i>
355 in the command line.
356 </p><p>
357 Note that the effect of defining TRACE and DEBUG is a global setting,
358 even if they are only defined in a single file.
359 </p><p>
360 </p></blockquote><h2>DEBUGGING SUPPORT</h2><blockquote>
361 When using the "-debug" flag, MCS will generate a file with the
362 extension .mdb that contains the debugging information for the
363 generated assembly. This file is consumed by the Mono debugger (mdb).
364 </blockquote><h2>ENVIRONMENT VARIABLES</h2><blockquote>
365 <dl><dt>
366 <i>MCS_COLORS</i></dt><dd>
367 If this variable is set, it contains a string in the form
368 "foreground,background" that specifies which color to use to display
369 errors on some terminals.
371 The background is optional and defaults to your terminal current
372 background. The possible colors for foreground are:
373 <b>black, red, brightred, green, brightgreen, yellow, brightyellow,</b>
374 blue, brightblue, magenta, brightmagenta, cyan, brightcyan, grey,
375 white and brightwhite.
376 </p><p>
377 The possible colors for background are: black, red, green, yellow,
378 blue, magenta, cyan, grey and white.
379 </p><p>
380 For example, you could set these variable from your shell:
381 </p><pre>
383 export MCS_COLORS
384 MCS_COLORS=errors=brightwhite,red
385 </pre>
387 You can disable the built-in color scheme by setting this variable to
388 "disable".
389 </p></dd></dl></blockquote><h2>NOTES</h2><blockquote>
390 During compilation the MCS compiler defines the __MonoCS__ symbol,
391 this can be used by pre-processor instructions to compile Mono C#
392 compiler specific code. Please note that this symbol is only to test
393 for the compiler, and is not useful to distinguish compilation or
394 deployment platforms.
395 </blockquote><h2>AUTHORS</h2><blockquote>
396 The Mono C# Compiler was written by Miguel de Icaza, Ravi Pratap,
397 Martin Baulig, Marek Safar and Raja Harinath. The development was
398 funded by Ximian, Novell and Marek Safar.
400 </p></blockquote><h2>LICENSE</h2><blockquote>
401 The Mono Compiler Suite is released under the terms of the GNU GPL.
402 Please read the accompanying `COPYING' file for details. Alternative
403 licensing for the compiler is available from Novell.
405 </p></blockquote><h2>SEE ALSO</h2><blockquote>
406 mdb(1), mono(1), mopen(1), mint(1), sn(1)
408 </p></blockquote><h2>BUGS</h2><blockquote>
409 To report bugs in the compiler, you must file them on our bug tracking
410 system, at:
411 http://www.mono-project.com/Bugs
412 </blockquote><h2>MAILING LIST</h2><blockquote>
413 The Mono Mailing lists are listed at http://www.mono-project.com/Mailing_Lists
414 </blockquote><h2>MORE INFORMATION</h2><blockquote>
415 The Mono C# compiler was developed by Novell, Inc
416 (http://www.novell.com, http) and is based on the
417 ECMA C# language standard available here:
418 http://www.ecma.ch/ecma1/STAND/ecma-334.htm
420 The home page for the Mono C# compiler is at http://www.mono-project.com/CSharp_Compiler