diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2011-11-25 21:20:47 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2011-11-25 21:20:47 +0000 |
commit | 6e56d874712a3f665534fd7607e7bde51f13fc83 (patch) | |
tree | 394dce7bcee7cbfc9846e0febfb537a10e318d11 /Doc | |
parent | 6a74028e65821de5cf1650bb906d8deaf177a4a5 (diff) | |
download | swig-6e56d874712a3f665534fd7607e7bde51f13fc83.tar.gz |
Fix inconsistencies in Java and C# getCPtr() and pointer constructor visibility - change to protected/internal from public. Add SWIG_JAVABODY_PROXY, SWIG_JAVABODY_TYPEWRAPPER and SWIG_CSBODY_PROXY, SWIG_CSBODY_TYPEWRAPPER for users to easily change when using multiple modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12844 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Manual/CSharp.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html index eacd29853..521114cdf 100644 --- a/Doc/Manual/CSharp.html +++ b/Doc/Manual/CSharp.html @@ -1656,6 +1656,40 @@ 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>18.5 Multiples modules</H2> + +<p> +When using <a href="Modules.html">multiple modules</a> it is is possible to compile each SWIG generated wrapper +into a different assembly. +However, by default the generated code may not compile if +generated classes in one assembly use generated classes in another assembly. +The visibility of the +<tt>getCPtr()</tt> and pointer constructor generated from the <tt>csbody</tt> typemaps needs changing. +The default visibility is <tt>internal</tt> but it needs to be <tt>public</tt> for access from a different assembly. +Just changing 'internal' to 'public' in the typemap achieves this. +Two macros are available in <tt>csharp.swg</tt> to make this easier and using them is the preferred approach +over simply copying the typemaps and modifying as this is forward compatible with any changes in +the <tt>csbody</tt> typemap in future versions of SWIG. +The macros are for the proxy and typewrapper classes and can respectively be used to +to make the method and constructor public: +</p> + +<div class="code"> +<pre> + SWIG_CSBODY_PROXY(public, public, SWIGTYPE) + SWIG_CSBODY_TYPEWRAPPER(public, public, public, SWIGTYPE) +</pre> +</div> + +<p> +Alternatively, instead of exposing these as public, consider +using the <tt>[assembly:InternalsVisibleTo("Name")]</tt> attribute available in the .NET framework when you +know which assemblies these can be exposed to. +Another approach would be to make these public, but also to hide them from intellisense by using +the <tt>[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</tt> attribute +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>18.7 C# Typemap examples</H2> |