[Scilab-Dev] Problem with interface.
Allan CORNET
allan.cornet at inria.fr
Mon May 26 15:38:25 CEST 2008
Hi ,
Try this :
int Test( char* fname )
{
int m1 = 0,n1 = 0,l1 = 0;
CheckRhs(1,1);
CheckLhs(1,1);
GetRhsVar( 1,STRING_DATATYPE, &m1, &n1, &l1);
printf("%s from %s\n",cstk(l2), fname);
m1 = 1;
n1 = 1;
l1 = 0;
CreateVar( Rhs+1, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1 );
*istk(l1) = 321654;
LhsVar(1) = Rhs + 1;
PutLhsVar();
return 0;
}
Allan CORNET
-----Message d'origine-----
De : irf610 at gmail.com [mailto:irf610 at gmail.com] De la part de Jonathan
Blanchard
Envoyé : lundi 26 mai 2008 15:15
À : dev at lists.scilab.org
Objet : [Scilab-Dev] Problem with interface.
I try to write an interface for a dynamically link routine in Scilab
5. The routine is meant to be invoked by using the short call syntax.
Here is a striped down example of my C code. When called Scilab 5
report an EXCEPTION_ACCESS_VIOLATION and the return value is simply
the name of the function.
Fore example this script :
a = call( 'test' );
a would be equal to "Test".
I tried different compiler with the same results.( GCC, LCC ). BTW I'm
on win XP SP2(32Bit).
int DLL_EXPORT Test( char* fname )
{
CheckRhs(1,1);
CheckLhs(1,1);
int m1, n1;
static int l1;
GetRhsVar( 1,STRING_DATATYPE, &m1, &n1, &l1);
m1 = 1;
n1 = 1;
CreateVar( 2, MATRIX_OF_INTEGER_DATATYPE, &m1, &n1, &l1 );
*istk(l1) = 321654;
LhsVar(1) = 2;
PutLhsVar();
return 0;
}
--
Jonathan Blanchard
BlanchardJ at ieee.org
More information about the dev
mailing list