1CIL(Linker)                                                        CIL(Linker)
2
3
4

NAME

6       Mono CIL Linker
7

SYNOPSIS

9       monolinker  [-o  output_directory][-l i18n_assemblies][-c skip | copy |
10       link] -x descriptor | -a assembly | -i info_file ...
11

DESCRIPTION

13       monolinker is a CIL Linker.  The linker is a tool one can use  to  only
14       ship the minimal possible set of functions that a set of programs might
15       require to run as opposed to the full libraries.
16
17       The linker analyses the intermediate code (CIL) produced by every  com‐
18       piler targeting the Mono platform like mcs, gmcs, vbnc, booc or others.
19       It will walk through all the code that it is given to  it,  and  remove
20       all  the  unused  methods  and  classes.  This is done using a mark and
21       sweep operation on all the code that it is referenced.
22
23       The generated output from the monolinker can be later processed by  the
24       mkbundle tool to generate small native self-contained executables.
25
26       Do  not confuse this with the Assembly Linker (al) which creates assem‐
27       blies from manifests, modules and resource files.
28

OPTIONS

30       -d search_directory
31              Specify a directory to the linker where to look for assemblies.
32
33       -o output_directory
34              Specify the output directory, default is 'output'.
35
36              If you specify the directory `.', please ensure that  you  won't
37              write over important assemblies of yours.
38
39       -b true | false
40              Specify  whether  to  generate  debug symbols or not, default is
41              false.
42
43       -g true | false
44              Specify whether to generate a new guid for each linked module or
45              reuse the existing one, default is true.
46
47       -l i18n_assemblies
48              Specify what to do with the region specific assemblies
49
50              Mono have a few assemblies which contains everything region spe‐
51              cific:
52                   I18N.CJK.dll
53                   I18N.MidEast.dll
54                   I18N.Other.dll
55                   I18N.Rare.dll
56                   I18N.West.dll
57
58              By default, they will all be copied to the output directory, but
59              you  can  specify  which  one  you  want using this command. The
60              choice can either be: none, all, cjk, mideast,  other,  rare  or
61              west. You can combine the values with a comma.
62
63       -c action
64              Specify the action to apply to the core assemblies.
65
66              Core  assemblies  are  the  assemblies  that belongs to the base
67              class library,  like  mscorlib.dll,  System.dll  or  System.Win‐
68              dows.Forms.dll.
69
70              The  linker  supports  three operations on these assemblies, you
71              can specify one of the following actions:
72
73              skip   This instructs the linker to skip  them  and  do  nothing
74                     with them.
75
76              copy   This  instructs  the  linker  to  copy them to the output
77                     directory,
78
79              link   This instructs the linker to apply  the  linking  process
80                     and reduce their size.
81
82
83       -p action assembly
84              Specify per assembly which action to apply.
85
86       -x descriptor
87              Use an XML descriptor as a source for the linker.
88
89              Here is an example that shows all the possibilities of this for‐
90              mat:
91
92              <linker>
93                   <assembly fullname="Library">
94                        <type fullname="Foo" />
95                        <type fullname="Bar" preserve="nothing" required="false" />
96                        <type fullname="Baz" preserve="fields" required="false" />
97                        <type fullname="Gazonk">
98                             <method signature="System.Void .ctor(System.String)" />
99                             <field signature="System.String _blah" />
100                             <field name="someFieldName" />
101                        </type>
102                   </assembly>
103              </linker>
104
105              In this example, the linker will link the types  Foo,  Bar,  Baz
106              and Gazonk.
107
108              The  preserve  attribute ensures that all the fields of the type
109              Baz will be always be linked, not matter if  they  are  used  or
110              not,  but  that neither the fields or the methods of Bar will be
111              linked if they are not used. Not specifying a preserve attribute
112              implies that we are preserving everything in the specified type.
113
114              The required attribute specifies that if the type is not marked,
115              during the mark operation, it will not be linked.
116
117              The type Gazonk will be linked, as well as its constructor  tak‐
118              ing a string as a parameter, and it's _blah field.
119
120              You can have multiple assembly nodes.
121
122       -a assemblies
123              use an assembly as a source for the linker.
124
125              The  linker will walk through all the methods of the assembly to
126              generate only what is necessary for this assembly to run.
127
128       -i info_file
129              use a .info xml file as a source for the linker.
130
131              An info file is a file produced by the tool  mono-api-info.  The
132              linker  will  use  it to generate an assembly that contains only
133              what the public API defined in the info file needs.
134
135       -s [StepBefore:]StepFullName,StepAssembly[:StepAfter]
136
137              You can ask the linker to execute custom steps by using  the  -s
138              command.  This  command takes the standard TypeFullName,Assembly
139              format to locate the step. You can customize its position in the
140              pipeline by either adding it before a step, or after.
141
142              Example:
143
144              using System;
145
146              using Mono.Linker;
147              using Mono.Linker.Steps;
148
149              namespace Foo {
150
151                   public class FooStep : IStep {
152
153                        public void Process (LinkContext context)
154                        {
155                             foreach (IStep step in context.Pipeline.GetSteps ()) {
156                                  Console.WriteLine (step.GetType ().Name);
157                             }
158                        }
159                   }
160              }
161
162              If  you  compile  this  custom  against  monolinker to a Foo.dll
163              assembly, you can use the -s switch as  follows.    To  add  the
164              FooStep at the end of the pipeline:
165
166                   monolinker -s Foo.FooStep,Foo -a program.exe
167
168              This commanand will add the FooStep after the MarkStep:
169
170                   monolinker -s MarkStep:Foo.FooStep,Foo -a program.exe
171
172              This command will add the FooStep before the MarkStep:
173
174                   monolinker -s Foo.FooStep,Foo:MarkStep -a program.exe
175
176              This command will add the FooStep before the MarkStep
177
178       -m CustomParam ParamValue
179              Specify a parameter for a custom step.
180
182       Copyright (C) 2007 Novell, Inc (http://www.novell.com)
183

BUGS

185       Bugs report are welcome at http://bugzilla.xamarin.com
186
187       Product Mono Tools, Component linker.
188

MAILING LISTS

190       Mailing   lists   are   listed   at  http://www.mono-project.com/commu
191       nity/help/mailing-lists/
192

WEB SITE

194       http://www.mono-project.com/docs/tools+libraries/tools/linker/
195

AUTHORS

197       The linker has been written  by  Jb  Evain,  and  have  been  partially
198       founded by the Google Summer of Code.
199

LICENSE

201       The  linker  is  licensed  under  the  MIT/X11 license. Please read the
202       accompayning MIT.X11 file for details.
203

SEE ALSO

205       al(1),mkbundle(1),mono(1),mcs(1).
206
207
208
209                                  monolinker                       CIL(Linker)
Impressum