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:Bob Little (rlit@webfrontdevelopment.com)
Date:Oct 15, 2008 6:18:06 am
List:net.java.dev.jna.users

Timothy,

Thanks for the replies. Your point about char* vs char** is well taken, and gets back to what my original question was (or should have been): Where can I find further examples of the proper use of com.sun.jna.Pointer and com.sun.jna.ptr.ByReference?

I know that QM is using memcpy() to move data from the database to the client library. As I've said, I'm pretty much a novice C programmer so I don't know if he's using a pointer (char*) or a pointer to a pointer (char**) here.

I also don't know if its ok for me to post too much code here, but this is the relevant section that modifies the arguments:

/* Now update any returned arguments */

offset = offsetof(INBUFF, data.call.argdata); if (offset < buff_bytes) { va_start(ap, argc); for (i = 1; i <= argc; i++) { argptr = (ARGDATA *)(((char *)buff) + offset);

arg = va_arg(ap, char *); if (i == argptr->argno) { arg_len = LongInt(argptr->arglen); memcpy(arg, argptr->text, arg_len); arg[arg_len] = '\0';

offset += offsetof(ARGDATA, text) + ((LongInt(argptr->arglen) + 1) & ~1); if (offset >= buff_bytes) break; } } va_end(ap);

/* */

Thanks once again for your patience here. It really is appreciated. -bob

On Tue, 2008-10-14 at 23:04 -0400, Timothy Wall wrote:

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*).

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?