html fixes and section updates

This commit is contained in:
William S Fulton 2014-03-15 21:18:46 +00:00
commit 785d93d9fb
34 changed files with 1152 additions and 1024 deletions

View file

@ -5,7 +5,7 @@
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body bgcolor="#FFFFFF">
<H1><a name="CSharp"></a>19 SWIG and C#</H1>
<H1><a name="CSharp"></a>20 SWIG and C#</H1>
<!-- INDEX -->
<div class="sectiontoc">
<ul>
@ -52,7 +52,7 @@
<H2><a name="CSharp_introduction"></a>19.1 Introduction</H2>
<H2><a name="CSharp_introduction"></a>20.1 Introduction</H2>
<p>
@ -72,13 +72,14 @@ The <a href="http://msdn.microsoft.com">Microsoft Developer Network (MSDN)</a> h
Monodoc, available from the Mono project, has a very useful section titled <a href="http://www.mono-project.com/Interop_with_Native_Libraries">Interop with native libraries</a>.
</p>
<H3><a name="CSharp_introduction_swig2_compatibility"></a>19.1.1 SWIG 2 Compatibility</H3>
<H3><a name="CSharp_introduction_swig2_compatibility"></a>20.1.1 SWIG 2 Compatibility</H3>
<p>
In order to minimize name collisions between names generated based on input to SWIG and names used in the generated code from the .NET framework, SWIG 3 fully qualifies the use of all .NET types. Furthermore, SWIG 3 avoids <tt>using</tt> directives in generated code. This breaks backwards compatibility with typemaps, pragmas, etc written for use with SWIG 2 that assume the presence of <tt>using System;</tt> or <tt>using System.Runtime.InteropServices;</tt> directives in the intermediate class imports, module imports, or proxy imports. SWIG 3 supports backwards compatibility though the use of the <tt>SWIG2_CSHARP</tt> macro. If <tt>SWIG2_CSHARP</tt> is defined, SWIG 3 generates <tt>using</tt> directives in the intermediate class, module class, and proxy class code similar to those generated by SWIG 2. This can be done without modifying any of the input code by passing the <tt>-DSWIG2_CSHARP</tt> commandline parameter when executing <tt>swig</tt>.
</p>
<H2><a name="CSharp_differences_java"></a>19.2 Differences to the Java module</H2>
<H2><a name="CSharp_differences_java"></a>20.2 Differences to the Java module</H2>
<p>
@ -491,7 +492,7 @@ Windows users can also get the examples working using a
<a href="http://www.cygwin.com">Cygwin</a> or <a href="http://www.mingw.org">MinGW</a> environment for automatic configuration of the example makefiles.
Any one of the three C# compilers (Portable.NET, Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
<H2><a name="CSharp_void_pointers"></a>19.3 Void pointers</H2>
<H2><a name="CSharp_void_pointers"></a>20.3 Void pointers</H2>
<p>
@ -509,7 +510,7 @@ void * f(void *v);
</pre>
</div>
<H2><a name="CSharp_arrays"></a>19.4 C# Arrays</H2>
<H2><a name="CSharp_arrays"></a>20.4 C# Arrays</H2>
<p>
@ -521,7 +522,7 @@ with one of the following three approaches; namely the SWIG C arrays library, P/
pinned arrays.
</p>
<H3><a name="CSharp_arrays_swig_library"></a>19.4.1 The SWIG C arrays library</H3>
<H3><a name="CSharp_arrays_swig_library"></a>20.4.1 The SWIG C arrays library</H3>
<p>
@ -558,7 +559,7 @@ example.print_array(c.cast()); // Pass to C
</div>
<H3><a name="CSharp_arrays_pinvoke_default_array_marshalling"></a>19.4.2 Managed arrays using P/Invoke default array marshalling</H3>
<H3><a name="CSharp_arrays_pinvoke_default_array_marshalling"></a>20.4.2 Managed arrays using P/Invoke default array marshalling</H3>
<p>
@ -685,7 +686,7 @@ and intermediary class method
</div>
<H3><a name="CSharp_arrays_pinning"></a>19.4.3 Managed arrays using pinning</H3>
<H3><a name="CSharp_arrays_pinning"></a>20.4.3 Managed arrays using pinning</H3>
<p>
@ -780,7 +781,7 @@ public static extern void myArrayCopy(global::System.IntPtr jarg1, global::Syste
<H2><a name="CSharp_exceptions"></a>19.5 C# Exceptions</H2>
<H2><a name="CSharp_exceptions"></a>20.5 C# Exceptions</H2>
<p>
@ -877,7 +878,7 @@ set so should only be used when a C# exception is not created.
</p>
<H3><a name="CSharp_exception_example_check_typemap"></a>19.5.1 C# exception example using "check" typemap</H3>
<H3><a name="CSharp_exception_example_check_typemap"></a>20.5.1 C# exception example using "check" typemap</H3>
<p>
@ -1059,7 +1060,7 @@ method and C# code does not handle pending exceptions via the canthrow attribute
Actually it will issue this warning for any function beginning with <tt>SWIG_CSharpSetPendingException</tt>.
</P>
<H3><a name="CSharp_exception_example_percent_exception"></a>19.5.2 C# exception example using %exception</H3>
<H3><a name="CSharp_exception_example_percent_exception"></a>20.5.2 C# exception example using %exception</H3>
<p>
@ -1124,7 +1125,7 @@ The managed code generated does check for the pending exception as mentioned ear
</pre>
</div>
<H3><a name="CSharp_exception_example_exception_specifications"></a>19.5.3 C# exception example using exception specifications</H3>
<H3><a name="CSharp_exception_example_exception_specifications"></a>20.5.3 C# exception example using exception specifications</H3>
<p>
@ -1181,7 +1182,7 @@ SWIGEXPORT void SWIGSTDCALL CSharp_evensonly(int jarg1) {
Multiple catch handlers are generated should there be more than one exception specifications declared.
</p>
<H3><a name="CSharp_custom_application_exception"></a>19.5.4 Custom C# ApplicationException example</H3>
<H3><a name="CSharp_custom_application_exception"></a>20.5.4 Custom C# ApplicationException example</H3>
<p>
@ -1315,7 +1316,7 @@ try {
</pre>
</div>
<H2><a name="CSharp_directors"></a>19.6 C# Directors</H2>
<H2><a name="CSharp_directors"></a>20.6 C# Directors</H2>
<p>
@ -1328,7 +1329,7 @@ The following sections provide information on the C# director implementation and
However, the <a href="Java.html#Java_directors">Java directors</a> section should also be read in order to gain more insight into directors.
</p>
<H3><a name="CSharp_directors_example"></a>19.6.1 Directors example</H3>
<H3><a name="CSharp_directors_example"></a>20.6.1 Directors example</H3>
<p>
@ -1449,7 +1450,7 @@ CSharpDerived - UIntMethod(123)
</pre>
</div>
<H3><a name="CSharp_directors_implementation"></a>19.6.2 Directors implementation</H3>
<H3><a name="CSharp_directors_implementation"></a>20.6.2 Directors implementation</H3>
<p>
@ -1632,7 +1633,7 @@ void SwigDirector_Base::BaseBoolMethod(Base const &amp;b, bool flag) {
</pre>
</div>
<H3><a name="CSharp_director_caveats"></a>19.6.3 Director caveats</H3>
<H3><a name="CSharp_director_caveats"></a>20.6.3 Director caveats</H3>
<p>
@ -1680,7 +1681,7 @@ However, a call from C# to <tt>CSharpDefaults.DefaultMethod()</tt> will of cours
should pass the call on to <tt>CSharpDefaults.DefaultMethod(int)</tt>using the C++ default value, as shown above.
</p>
<H2><a name="CSharp_multiple_modules"></a>19.7 Multiples modules</H2>
<H2><a name="CSharp_multiple_modules"></a>20.7 Multiples modules</H2>
<p>
@ -1715,7 +1716,7 @@ the <tt>[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrows
if you don't want users to easily stumble upon these so called 'internal workings' of the wrappers.
</p>
<H2><a name="CSharp_typemap_examples"></a>19.8 C# Typemap examples</H2>
<H2><a name="CSharp_typemap_examples"></a>20.8 C# Typemap examples</H2>
This section includes a few examples of typemaps. For more examples, you
@ -1723,7 +1724,7 @@ might look at the files "<tt>csharp.swg</tt>" and "<tt>typemaps.i</tt>" in
the SWIG library.
<H3><a name="CSharp_memory_management_member_variables"></a>19.8.1 Memory management when returning references to member variables</H3>
<H3><a name="CSharp_memory_management_member_variables"></a>20.8.1 Memory management when returning references to member variables</H3>
<p>
@ -1847,7 +1848,7 @@ public class Bike : global::System.IDisposable {
Note the <tt>addReference</tt> call.
</p>
<H3><a name="CSharp_memory_management_objects"></a>19.8.2 Memory management for objects passed to the C++ layer</H3>
<H3><a name="CSharp_memory_management_objects"></a>20.8.2 Memory management for objects passed to the C++ layer</H3>
<p>
@ -1966,7 +1967,7 @@ The 'cscode' typemap simply adds in the specified code into the C# proxy class.
</div>
<H3><a name="CSharp_date_marshalling"></a>19.8.3 Date marshalling using the csin typemap and associated attributes</H3>
<H3><a name="CSharp_date_marshalling"></a>20.8.3 Date marshalling using the csin typemap and associated attributes</H3>
<p>
@ -2252,7 +2253,7 @@ public class example {
</pre>
</div>
<H3><a name="CSharp_date_properties"></a>19.8.4 A date example demonstrating marshalling of C# properties</H3>
<H3><a name="CSharp_date_properties"></a>20.8.4 A date example demonstrating marshalling of C# properties</H3>
<p>
@ -2352,7 +2353,7 @@ Some points to note:
<li>The 'csin' typemap has 'pre', 'post' and 'cshin' attributes, and these are all ignored in the property set. The code in these attributes must instead be replicated within the 'csvarin' typemap. The line creating the <tt>temp$csinput</tt> variable is such an example; it is identical to what is in the 'pre' attribute.
</ul>
<H3><a name="CSharp_date_pre_post_directors"></a>19.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors</H3>
<H3><a name="CSharp_date_pre_post_directors"></a>20.8.5 Date example demonstrating the 'pre' and 'post' typemap attributes for directors</H3>
<p>
@ -2414,7 +2415,7 @@ Pay special attention to the memory management issues, using these attributes.
</p>
<H3><a name="CSharp_partial_classes"></a>19.8.6 Turning wrapped classes into partial classes</H3>
<H3><a name="CSharp_partial_classes"></a>20.8.6 Turning wrapped classes into partial classes</H3>
<p>
@ -2514,7 +2515,7 @@ demonstrating that the class contains methods calling both unmanaged code - <tt>
The following example is an alternative approach to adding managed code to the generated proxy class.
</p>
<H3><a name="CSharp_extending_proxy_class"></a>19.8.7 Extending proxy classes with additional C# code</H3>
<H3><a name="CSharp_extending_proxy_class"></a>20.8.7 Extending proxy classes with additional C# code</H3>
<p>
@ -2553,7 +2554,7 @@ public class ExtendMe : global::System.IDisposable {
</pre>
</div>
<H3><a name="CSharp_enum_underlying_type"></a>19.8.8 Underlying type for enums</H3>
<H3><a name="CSharp_enum_underlying_type"></a>20.8.8 Underlying type for enums</H3>
<P>