Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / man / mono-config.5
1 .\" 
2 .\" mono-config configuration page.
3 .\" (C) Ximian, Inc. 
4 .\" Author:
5 .\"   Miguel de Icaza (miguel@gnu.org)
6 .\"   Paolo Molaro (lupus@ximian.com)
7 .\"
8 .TH Mono "mono-config"
9 .SH NAME
10 mono-config \- Mono runtime file format configuration
11 .SH DESCRIPTION
12 The Mono runtime will load configuration data from the
13 installation prefix /etc/mono/config file, the ~/.mono/config or from
14 the file pointed by the MONO_CONFIG environment variable.
15 .PP
16 For each assembly loaded a config file with the name:
17 /path/to/the/assembly.exe.config is loaded as well as the
18 ~/.mono/assemblies/ASSEMBLY/ASSEMBLY.EXT.config file. 
19 .PP
20 This file controls the behavior of the runtime.
21 .PP
22 The file contains an XML-like file with various sections, all of them
23 contained inside a 
24 .B<configuration> 
25 section (It actually uses GMarkup
26 to parse the file).
27 .PP
28 This page describes the Unix-specific and Mono-specific extensions to
29 the configuration file;   For complete details, see the
30 http://www.mono-project.com/Config web page.
31 .SH <dllmap> directive
32 You use the dllmap directive to map shared libraries referenced by
33 P/Invoke in your assemblies to a different shared library.
34 .PP
35 This is typically used to map Windows libraries to Unix library names.
36 The 
37 .B dllmap
38 element takes two attributes:
39 .TP
40 .I dll
41 This should be the same string used in the DllImport attribute, optionally
42 prefixed with "i:" to indicate that the string must be matched in a
43 case-insensitive way
44 .TP
45 .I target
46 This should be the name of the library where the function can be found: 
47 this name should be suitable for use with the platform native shared library 
48 loading routines (dlopen etc.), so you may want to check the manpages for that, too.
49 .SH <dllentry> directive
50 This directive can be used to map a specific dll/function pair to a different
51 library and also a different function name. It should appear inside a
52 .B dllmap
53 element with only the dll attribute specified.
54 .PP
55 The
56 .B dllentry
57 element takes 3 attributes:
58 .TP
59 .I dll
60 This is the target library, where the function can be found.
61 .TP
62 .I name
63 This is the name of the function as it appears in the metadata: it is the name 
64 of the P/Invoke method.
65 .TP
66 .I target
67 This is the name of the function to lookup instead of the name specified in the 
68 P/Invoke method.
69 .SH Mapping based on operating system and cpu
70 Both the
71 .B dllmap
72 and the
73 .B dllentry
74 elements allow the following two attributes which make it easy to use a single
75 configuration file and support multiple operating systems and architectures with
76 different mapping requirements:
77 .TP
78 .I os
79 This is the name of the operating system for which the mapping should be applied.
80 Allowed values are: linux, osx, solaris, freebsd, openbsd, netbsd, windows, aix, hpux.
81 .TP
82 .I cpu
83 This is the name of the architecture for which the mapping should be applied.
84 Allowed values are: x86, x86-64, sparc, ppc, s390, s390x, arm, mips,
85 alpha, hppa, ia64.
86 .TP
87 .I wordsize
88 This is the size of registers on the target architecture, it can be
89 either 32 or 64.  
90 .PP
91 The attribute value for both attributes can be a comma-separated list of the allowed
92 values. Additionally, the first character may be a
93 .I '!'
94 to reverse the meaning. An attribute value of "!windows,osx", for example, would mean
95 that the entry is considered on all operating systems, except on Windows and OS X.
96 No spaces are allowed in any part of the value.
97 .PP
98 Note that later entries will override the entries defined earlier in the file.
99 .SH EXAMPLES
100 The following example maps references to the `cygwin1.dll' shared
101 library to the `libc.so.6' file.  
102 .nf
103 <configuration>
104         <dllmap dll="i:cygwin1.dll" target="libc.so.6"/>
105 </configuration>
106 .fi
107 The library name in the DllImport attribute is allowed to be in any
108 case variant, like the following examples:
109 .nf
110 .nf
111         [DllImport ("cygwin1.dll")]
112         [DllImport ("Cygwin1.dll")]
113         [DllImport ("cygwiN1.Dll")]
114 .fi
115 .PP
116 This one maps the following C# method:
117 .nf
118         [DllImport ("libc")]
119         static extern void somefunction ();
120 .fi
121 to
122 .B differentfunction
123 in
124 .B libdifferent.so
125 , but to the same function in the library
126 .B libanother.so
127 when running under the Solaris and FreeBSD operating systems.
128 .nf
129 <configuration>
130         <dllmap dll="libc">
131                 <dllentry dll="libdifferent.so" name="somefunction" target="differentfunction" />
132                 <dllentry os="solaris,freebsd" dll="libanother.so" name="somefunction" target="differentfunction" />
133         </dllmap>
134 </configuration>
135 .fi
136
137 .SH SEE ALSO
138 .BR mono(1), monodis(1), mint(1)