6 messages in net.java.dev.jna.usersRe: [jna-users] call by reference of ...
FromSent OnAttachments
Mr Young-soo SongFeb 29, 2008 1:38 am 
Timothy WallMar 2, 2008 6:16 am 
Mr Young-soo SongMar 3, 2008 7:42 pm 
Timothy WallMar 4, 2008 5:42 am 
Mr Young-soo SongMar 5, 2008 12:24 am 
Timothy WallMar 5, 2008 6:24 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] call by reference of double arrayActions...
From:Timothy Wall (twal@dev.java.net)
Date:Mar 2, 2008 6:16:06 am
List:net.java.dev.jna.users

If this is a COM DLL (that uses variants and safe arrays), you might be better off using JACOB, com4j or JAWIN, which know how to handle the various COM types.

However, if all you need is "double*" (which is what ByRef/Double nominally means), you can pass "double[]", "DoubleByReference" (if it's a single element), "com.sun.jna.Memory" (of the appropriate size), or java.io.DoubleBuffer (also of the appropriate size).

On Feb 29, 2008, at 4:39 AM, Mr Young-soo Song wrote:

Hi JNA gurus! I have only DLL binary and VB source in excel as following spec. Option Explicit Private Declare Function XXX Lib "C:\test\sample.dll" _ (ByRef bdtU As Double, ByRef bdtSigma As Double, _ ByVal bdtLength As Double, ByRef termOrg As Double, ByRef cpOrg As Double, _ ByRef capVolOrg As Double, _ ByVal isusd As Double, ByVal capFreq As Double, ByVal cpFreq As Double, ByVal lTerm As Double, _ ByVal inOutType As Double, _ ByRef capletVol As Double, ByRef returnExpZeroRate As Double, _ ByVal conventionDenom As Double) As Double

Sub Button1_Click()

Dim bdtU(100) As Double Dim bdtSigma(100) As Double ß this is output array that DLL changed. Dim bdtLength As Double Dim termOrg(100) As Double Dim cpOrg(100) As Double Dim capVolOrg(100) As Double Dim isusd As Double Dim capFreq As Double Dim cpFreq As Double Dim lTerm As Double Dim inOutType As Double Dim capletVol(100) As Double Dim returnExpZeroRate(100) As Double Dim conventionDenom As Double

How can I map the ByRef type of double array to JNA code?

I tried DoubleByReference for bdtSigma ( double array by reference ) With pointer as following but I couldn’t retrieve right value.

DoubleByReference bdtSigmaP = new DoubleByReference ();

ret_val= lib.BDT1(bdtU, bdtSigmaP, bdtLength, termOrg, cpOrg, capVolOrg, isusd, capFreq, cpFreq, lTerm, inOutType, capletVol,

returnExpZeroRate, conventionDenom);

Pointer p = bdtSigmaP.getPointer(); double[] ret= p.getDoubleArray(0, 100);

Any response will be appreciated. Thanks in advance. YS

180° 달라진 야후! 메일 두둥! 새로운 야후! 메일에서는 메시지를 여기저기 끌어다 놓을 수 있답니다.