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?