7 messages in net.java.dev.jna.usersRe: [jna-users] Reading back function...
FromSent OnAttachments
Bob LittleOct 13, 2008 1:34 pm 
Michael WhiteOct 13, 2008 3:34 pm 
Timothy WallOct 13, 2008 5:11 pm 
Bob LittleOct 14, 2008 7:07 pm 
Timothy WallOct 14, 2008 8:03 pm 
Bob LittleOct 15, 2008 6:18 am 
Timothy WallOct 15, 2008 6:45 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] Reading back function argumentsActions...
From:Timothy Wall (twal@dev.java.net)
Date:Oct 14, 2008 8:03:48 pm
List:net.java.dev.jna.users

On Oct 14, 2008, at 10:08 PM, Bob Little wrote:

Sorry, I have not explained very well. Let me try to correct that. I am only a novice C programmer, so please bear with me.

Here is what I have, and what I have done to test:

/* Original C Code definition */ void QMCall(char * subrname, short int argc, ...)

You'll have to figure out what mechanism your native code uses to modify the passed-in parameters. You say that the native routine gets the correct values when passed String arguments. This implies that the native function *cannot* modify those arguments; to do so it would need to receive those arguments by reference (char** instead of char*).

/* the database subroutine being called... */ LIST.ITEM BP TEST Page 1 TEST 001: SUBROUTINE(I.LIST,O.LIST,E.LIST) 002: OPEN 'RDL.TMP' TO RDL.TMP.FILE THEN 003: REC=I.LIST:" , ":O.LIST:", ":E.LIST 004: WRITE REC ON RDL.TMP.FILE,'TEST.ARGUMENTS' 005: END 006: I.LIST="IN" 007: O.LIST="OUT" 008: E.LIST="ERR" 009: RETURN 010: END :

The above subroutine "TEST" takes the 3 arguments, implicitly sets their values to "IN", "OUT", and "ERR" and returns them. As such, the values of in, out and err should be changed from 1,2,3 to IN, OUT, ERR. To verify that the subroutine is in fact being called, I open a file and write the arguments out to it.

java qmtest Invoking method qm.QMCall Inside method, calling lib function with: in=1, out=2, err=3 Inside method, returned from library function: in=1, out=2, err=3 Returned from method: iList=1 oList=2 eList=3

I was expecting iList=IN oList=OUT eList=ERR

The database sub routine is being called correctly, and is getting the right values: LIST.ITEM RDL.TMP Page 1 TEST.ARGUMENTS 001: 1 , 2, 3

I hope this explanation has enough information, and that it makes sense.

What converts the DB code into a shared library? There is some code that stands between the DLL interface and your DB code. What is it?