scilab: SWIG_ptr() accepts mlist typed pointers and converts them to pointers

This commit is contained in:
Simon Marchetto 2016-12-15 23:57:30 +01:00
commit 88b4827d87
3 changed files with 46 additions and 18 deletions

View file

@ -4,7 +4,7 @@
%inline %{
void* getNull() { return NULL; }
void *getNull() { return NULL; }
bool isNull(void *p) { return p == NULL; }
int foo = 3;
@ -15,4 +15,17 @@ bool equalFooPointer(void *p) { return p == pfoo; }
%}
%typemap(out, noblock=1) struct structA* {
if (SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), $1, SWIG_Scilab_TypeQuery("struct structA *"), 0, NULL) != SWIG_OK) {
return SWIG_ERROR;
}
SWIG_Scilab_SetOutput(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + SWIG_Scilab_GetOutputPosition());
}
%inline %{
struct structA {
int x;
};
%}