import source from 1.3.40
[external/swig.git] / Examples / csharp / arrays / example.i
1 /* File : example.i */
2 %module example
3
4 %{
5 #include "example.h"
6 %}
7 %include "arrays_csharp.i"
8
9 %apply int INPUT[]  { int* sourceArray }
10 %apply int OUTPUT[] { int* targetArray }
11
12 %apply int INOUT[] { int* array1 }
13 %apply int INOUT[] { int* array2 }
14
15 %include "example.h"
16
17 %clear int* sourceArray;
18 %clear int* targetArray;
19
20 %clear int* array1;
21 %clear int* array2;
22
23
24 // Below replicates the above array handling but this time using the pinned (fixed) array typemaps
25 %csmethodmodifiers "public unsafe";
26
27 %apply int FIXED[] { int* sourceArray }
28 %apply int FIXED[] { int* targetArray }
29
30 %inline %{
31 void myArrayCopyUsingFixedArrays( int *sourceArray, int* targetArray, int nitems ) {
32   myArrayCopy(sourceArray, targetArray, nitems);
33 }
34 %}
35
36 %apply int FIXED[] { int* array1 }
37 %apply int FIXED[] { int* array2 }
38
39 %inline %{
40 void myArraySwapUsingFixedArrays( int* array1, int* array2, int nitems ) {
41   myArraySwap(array1, array2, nitems);
42 }
43 %}
44
45