1 %module scilab_pointer_conversion_functions
2 
3 %warnfilter(SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) pfoo; /* Setting a pointer/reference variable may leak memory. */
4 
5 %inline %{
6 
getNull()7 void *getNull() { return NULL; }
isNull(void * p)8 bool isNull(void *p) { return p == NULL; }
9 
10 int foo = 3;
11 int *pfoo = &foo;
12 
getFooAddress()13 double getFooAddress() { return (double) (unsigned long) pfoo; }
equalFooPointer(void * p)14 bool equalFooPointer(void *p) { return p == pfoo; }
15 
16 %}
17 
18 %typemap(out, noblock=1) struct structA* {
19   if (SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), $1, SWIG_Scilab_TypeQuery("struct structA *"), 0, NULL) != SWIG_OK) {
20     return SWIG_ERROR;
21   }
22   SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
23 }
24 
25 %inline %{
26 
27 struct structA {
28   int x;
29 };
30 
31 %}
32