From: Eric Tittley on
"Benjamin " <bsanderse.remove.this(a)hotmail.com> wrote in message <hqkpi9$t5i$1(a)fred.mathworks.com>...
> Thanks for the suggestions. I added both -largeArrayDims and -m64 to the gfortran compiler flags, but unfortunately the problem persists. Any other suggestions?

Hi Ben,

Did you find a solution to your problem?

I have a similar problem running on a 64bit Linux system:
Linux 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 x86_64 GNU/Linux

However, my problem is that I cannot get the code to run when using -largeArrayDims.

Like you, I also used the timestwo.F as a test function.

mex timestwo.F WORKS
mex -largeArrayDims timestwo.F FAILS
mex timestwo.c WORKS
mex -largeArrayDims timestwo.c WORKS

By "WORKS" I mean that:
>> X=5; timestwo(X)
ans =
10

By "FAIL", I mean:
>> X=5; timestwo(X)
??? Error using ==> timestwo
Too many output arguments.

(which is really just an indication that the test (nlhs .gt. 1) is failing, which it does so since it (probably) thinks nlhs is a long integer, when matlab is actually passing it a 4-byte integer.
nlhs is declared as:
mwsize nlhs, nrhs
and with -largeArrayDims, mwsize is integer*8

Matlab is 64bit: Version 7.8.0.347 (R2009a) 64-bit (glnxa64)

Perhaps they are different problems. Could it be the compiler version? I'm using:
GNU Fortran (Debian 4.3.2-1.1) 4.3.2
From: Benjamin Sanderse on
Hi Eric,

Nice that your mex-files are compiling. My problem is that I cannot compile on my Macbook, on Linux 64bits everythings works perfectly.
Regarding your problem: I think you somehow have to use the int64 command in Matlab and do something like
a = timestwo(x),

because Matlab wants you to put this a=... notation (if you have specified nlhs(1)).

Hope this helps...

Ben

in case you want
"Eric Tittley" <3ert(a)delete.this.and.the.3.roe.ac.uk> wrote in message <hu3628$6n9$1(a)fred.mathworks.com>...
> "Benjamin " <bsanderse.remove.this(a)hotmail.com> wrote in message <hqkpi9$t5i$1(a)fred.mathworks.com>...
> > Thanks for the suggestions. I added both -largeArrayDims and -m64 to the gfortran compiler flags, but unfortunately the problem persists. Any other suggestions?
>
> Hi Ben,
>
> Did you find a solution to your problem?
>
> I have a similar problem running on a 64bit Linux system:
> Linux 2.6.26-2-amd64 #1 SMP Tue Mar 9 22:29:32 UTC 2010 x86_64 GNU/Linux
>
> However, my problem is that I cannot get the code to run when using -largeArrayDims.
>
> Like you, I also used the timestwo.F as a test function.
>
> mex timestwo.F WORKS
> mex -largeArrayDims timestwo.F FAILS
> mex timestwo.c WORKS
> mex -largeArrayDims timestwo.c WORKS
>
> By "WORKS" I mean that:
> >> X=5; timestwo(X)
> ans =
> 10
>
> By "FAIL", I mean:
> >> X=5; timestwo(X)
> ??? Error using ==> timestwo
> Too many output arguments.
>
> (which is really just an indication that the test (nlhs .gt. 1) is failing, which it does so since it (probably) thinks nlhs is a long integer, when matlab is actually passing it a 4-byte integer.
> nlhs is declared as:
> mwsize nlhs, nrhs
> and with -largeArrayDims, mwsize is integer*8
>
> Matlab is 64bit: Version 7.8.0.347 (R2009a) 64-bit (glnxa64)
>
> Perhaps they are different problems. Could it be the compiler version? I'm using:
> GNU Fortran (Debian 4.3.2-1.1) 4.3.2
From: James Tursa on
"Benjamin Sanderse" <bsanderse(a)hotmail.com> wrote in message <hu39kl$bql$1(a)fred.mathworks.com>...
>
> Regarding your problem: I think you somehow have to use the int64 command in Matlab and do something like
> a = timestwo(x),
>
> because Matlab wants you to put this a=... notation (if you have specified nlhs(1)).

No. You can always set prhs(1) even if nlhs = 0. MATLAB always reserves at least one spot so the answer can appear as ans if necessary.

James Tursa
From: James Tursa on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hu3eb6$3eg$1(a)fred.mathworks.com>...
> "Benjamin Sanderse" <bsanderse(a)hotmail.com> wrote in message <hu39kl$bql$1(a)fred.mathworks.com>...
> >
> > Regarding your problem: I think you somehow have to use the int64 command in Matlab and do something like
> > a = timestwo(x),
> >
> > because Matlab wants you to put this a=... notation (if you have specified nlhs(1)).
>
> No. You can always set prhs(1) ...

Typo ... should have written plhs(1)

James Tursa