[Scilab-Dev] Problem with interface.

Jonathan Blanchard BlanchardJ at ieee.org
Mon May 26 15:54:43 CEST 2008


Thank you for your reply but it give the same result. First I assumed
you meant l1 on the printf line because l2 does not exist.
Secondly it does the exact same thing. But if I remove the printf
line, Scilab complain about a bad call to createvar :

TestGetRFAttenuation: bad call to createvar! (1rst argument).

On Mon, May 26, 2008 at 10:38 AM, Allan CORNET <allan.cornet at inria.fr> wrote:
> 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
>
>



-- 
Jonathan Blanchard
BlanchardJ at ieee.org



More information about the dev mailing list