7 messages in net.java.dev.jna.usersRe: [jna-users] Pointer to double
FromSent OnAttachments
xfloAug 3, 2007 9:28 am 
Timothy WallAug 3, 2007 10:14 am 
"Adrián J.Montero Calvo"Aug 4, 2007 4:16 am.log
xfloAug 4, 2007 12:16 pm.log
Timothy WallAug 8, 2007 8:52 am 
xfloAug 10, 2007 4:04 pm 
xfloAug 11, 2007 12:51 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] Pointer to doubleActions...
From:xflo (xf@lycos.es)
Date:Aug 11, 2007 12:51:22 am
List:net.java.dev.jna.users

SOLVED! Mi described solution is good. The problem was the c library, the typical double free problem when a memory location is erased twice. Now it works great! Thanks for help.

Sorry but I don't finish the problem, The c header: low.h double* low(double *x, double *y,int size);

______________________________________________________________

The c file low.c double* low(double *x, double *y,int size){ double *ys; ys = (double *) malloc( (size) * sizeof(double)); clow(x, y,size,ys); free(x); free(y); return ys; }

______________________________________________________________________ The java interface iLow.java public interface iLow extends Library{ iLow INSTANCE = (iLow)Native.loadLibrary("low", iLow.class); Pointer low( double[] x, double[] y,int size); }

________________________________________________________________________ My java class myclass.java ... iLow Lib = iLow.INSTANCE; Pointer P =new Memory((D.length) * Double.SIZE); P= Lib.low(D,R, D.length); L = P.getDoubleArray(0,D.length); P=null; ...

____________________________________________________________________________

I've done test and myclass.java calls to the function correctly. The function works correctly,but what the library return produces the known error. By the way; In my C code: sizeof(double)=8 and In my Java code: Double.SIZE=64

Thanks in advance.