From 2824b0cbb66e715490e1ef13250bd675d87b32d9 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 2 Jun 2010 20:53:17 +0000 Subject: rel-2.0.0 git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/tags/rel-2.0.0@12089 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- trunk/Examples/csharp/arrays/example.i | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 trunk/Examples/csharp/arrays/example.i (limited to 'trunk/Examples/csharp/arrays/example.i') diff --git a/trunk/Examples/csharp/arrays/example.i b/trunk/Examples/csharp/arrays/example.i new file mode 100644 index 000000000..488565a74 --- /dev/null +++ b/trunk/Examples/csharp/arrays/example.i @@ -0,0 +1,45 @@ +/* File : example.i */ +%module example + +%{ +#include "example.h" +%} +%include "arrays_csharp.i" + +%apply int INPUT[] { int* sourceArray } +%apply int OUTPUT[] { int* targetArray } + +%apply int INOUT[] { int* array1 } +%apply int INOUT[] { int* array2 } + +%include "example.h" + +%clear int* sourceArray; +%clear int* targetArray; + +%clear int* array1; +%clear int* array2; + + +// Below replicates the above array handling but this time using the pinned (fixed) array typemaps +%csmethodmodifiers "public unsafe"; + +%apply int FIXED[] { int* sourceArray } +%apply int FIXED[] { int* targetArray } + +%inline %{ +void myArrayCopyUsingFixedArrays( int *sourceArray, int* targetArray, int nitems ) { + myArrayCopy(sourceArray, targetArray, nitems); +} +%} + +%apply int FIXED[] { int* array1 } +%apply int FIXED[] { int* array2 } + +%inline %{ +void myArraySwapUsingFixedArrays( int* array1, int* array2, int nitems ) { + myArraySwap(array1, array2, nitems); +} +%} + + -- cgit v1.2.1