[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: External C DLL crashes Octave
From: |
Jaroslav Hajek |
Subject: |
Re: External C DLL crashes Octave |
Date: |
Fri, 28 Aug 2009 22:01:18 +0200 |
On Fri, Aug 28, 2009 at 9:44 PM, mishrapiyush<address@hidden> wrote:
>
> Tatsuro,
>
> Thanks for replying to promptly.. I am using Octave 3.2.0, which is the
> latest Win binary. I believe it is the MinGW version. I am able to compile
> and call the sample application (d_gcc) but was having problem with my Cpp
> code.
>
> In the meantime, I have found the reason of crash - it was due to an
> error in my DEFUN_DLD function. Basically, I want to pass an array of
> Doubles to my C function, say, as follows:
> x = [10 100 1000 10000] %array of Doubles
> mycodewrapper(x) %containing func1
>
> as stated earlier, func1 is defined as follows:
> extern "C" unsigned int func1(double *x);
>
> I have tried:
> Matrix B = args(0).matrix_value();
> double* A = B.Rep->data;"
> but rep is now protected and hence compilation fails.
>
> Could you recommend a good way to convert args of DEFUN_DLD into a pointer
> of doubles. Is there a variation on "double* A = B.data()" which will allow
> me to cast const double* to double*?
>
B.Rep->data would be wrong anyway. B.fortran_vec() correctly extracts
a writable pointer.
hth
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
Re: External C DLL crashes Octave, Benjamin Lindner, 2009/08/30