It didn't work either, but I have find out what was breaking the code :<br
/><br />I was using the same name for scilab function and c-function, that
is to say, ocltest in Scilab called the ocltest C-function. When I changed
the name in my builder_gateway_c.sce file, everything worked as
expected.<br />However I don't know if this can be considered as a
"bug" , as this kind of naming convention is somehow not
recommanded...<br /><br />Le Jeu 5 novembre 2009 16:38, Serge Steer a
écrit :<br />> In my opinion the code should be
(createMatrixOfDouble allocates the<br />> array and returns a
pointer)<br />> <br />> #include "stack-c.h"<br />>
#include "api_scilab.h"<br />> #include
"Scierror.h"<br />> <br />> <br />> int oclexec(char*
fname) {<br />> SciErr sciErr;<br />> int *pB; int rowsB,colsB;
double* mB; int k;<br />> <br />> sciErr =
createMatrixOfDouble(pvApiCtx, Rhs + 1, rowsB, colsB,mB ); <br />>
if(sciErr.iErr) {<br />> printError(&sciErr, 0); return 0; }<br
/>> <br />> <br />> for(k=0;k<rowsB*colsB;++k) {<br />>
mB[k]=1.0; }<br />> LhsVar(1)=Rhs+1;<br />> <br />> <br />>
return 0; }<br />> <br />> <br />> <br />> <br />> Vincent
Lejeune a écrit :<br />> <br />>> <br />>> Hi,<br
/>>> <br />>> <br />>> I don't know if it's a bug or if
something is missing in my code...<br />>> The issue is : using the
following code, I cannot get scilab to<br />>> display the mB matrix
:<br />>> <br />>> #include "stack-c.h"<br
/>>> #include "api_scilab.h"<br />>> #include
"Scierror.h"<br />>> <br />>> <br />>> int
oclexec(char* fname) {<br />>> SciErr sciErr;<br />>> int *pB;
int rowsB,colsB; double* mB; int k;<br />>> <br />>>
mB=(double*)malloc(rowsB*colsB*sizeof(double));<br />>> <br
/>>> <br />>> for(k=0;k<rowsB*colsB;++k) {<br />>>
mB[k]=1.0; }<br />>> <br />>> <br />>> sciErr =
createMatrixOfDouble(pvApiCtx, Rhs + 1, rowsB, colsB,mB ); <br />>>
if(sciErr.iErr) {<br />>> printError(&sciErr, 0); return 0; }<br
/>>> <br />>> <br />>> LhsVar(1)=Rhs+1;<br />>>
<br />>> <br />>> return 0; }<br />>> <br />>> <br
/>>> The gateway is compiling fine, but when I type B=ocltest(A); ,
the B<br />>> matrix is equal to A, whereas it is expected to be a
ones matrix.<br />>> <br />>> On the other hand, the unary
test double_writing_api.tst works.<br />>> I'am currently using the
windows 1257195239 build (taken from the<br />>> nightly build of
scilab 5.2)<br />>> <br />>> Regards,<br />>> Vincent<br
/>>> <br />>> <br />> <br />>