[Scilab-users] scilab-fortran issues

Paul Bignier paul.bignier at scilab-enterprises.com
Mon Jan 20 11:23:53 CET 2014


Hello Eduardo,

The call() primitive is not (yet?) suited for string matrices, because 
there is a confusion about the "size" of it: right now, the gateway 
detects the size of a scalar string, but when it is a matrix, each 
element can have a proper size (buffer) and there is also the matrix 
size itself.
To avoid this confusion, the gateway only allows scalar strings, so the 
"size" of the argument actually represents its length (for instance, 
ident="STR1" will be detected as having a 4x1 size).

This is documented in the help page 
<http://help.scilab.org/docs/5.4.1/en_US/call.html>, the arguments can 
be "real matrices" or [scalar] "strings".

So my only suggestion at the moment is to pass ident as the 
concatenation of its elements, and to split it (or iterate on its 
length) in the Fortran routine. ident = "STR1"+"STR2"+"STR3"+...

Hope this helps, otherwise feel free to report a bug on 
http://bugzilla.scilab.org/
Regards,
Paul


On 01/15/2014 09:01 PM, Eduardo Torrecillas wrote:
> Hello all,
>
> I am very used to dynamic linking scilab and Fortran, and call the 
> external function by the "call" function in SciLab.
>
> Although, this is the first time I try to send string matrices as 
> fortran arguments, and I can't get it working. Maybe any of you can 
> please help?
>
> I want to pass a column-vector where each row contains a 4-char 
> string. Example:
>
> ident=['STR1';'STR2';'STR3';...]
>
> Now the F90 code I'm trying:
>
> subroutine fhdg_dist(napt,ident,ret_val)
> implicit none
> INTEGER,INTENT(IN)::napt
> character(len=4),intent(in),dimension(napt,1)::ident
> integer,intent(out)::ret_val
>
> ret_val=0
>
> end subroutine fhdg_dist
>
>
> the call statement:
>
> [ret_val]=call('fhdg_dist',napt,1,'i',ident,2,'c','out',[1,1],3,'i')
>
> So, even if I'm not trying to use the matrix data, when calling the 
> external function with this call, I get "incompatible dimensions" message.
>
> Any clues, please?
>
> Regards.
>
>
> -- 
> Eduardo Torrecillas
> AER-09
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

-- 
Paul BIGNIER
Scilab Engineer & Xcos Developer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.69
http://www.scilab-enterprises.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140120/005f5149/attachment.htm>


More information about the users mailing list