22 messages in net.java.dev.jna.usersRe: [jna-users] Structure by value an...
FromSent OnAttachments
Edroaldo Lummertz da RochaNov 7, 2008 3:21 pm 
Timothy WallNov 7, 2008 4:44 pm 
Edroaldo Lummertz da RochaNov 10, 2008 6:07 am 
Timothy WallNov 10, 2008 6:34 am 
Edroaldo Lummertz da RochaNov 10, 2008 6:59 am 
Timothy WallNov 10, 2008 7:57 am 
Edroaldo Lummertz da RochaNov 10, 2008 8:38 am 
Timothy WallNov 10, 2008 10:40 am 
Edroaldo Lummertz da RochaNov 10, 2008 12:17 pm 
Timothy WallNov 10, 2008 1:46 pm 
Edroaldo Lummertz da RochaNov 10, 2008 1:57 pm 
Timothy WallNov 10, 2008 6:27 pm 
Edroaldo Lummertz da RochaNov 11, 2008 3:25 am 
Edroaldo Lummertz da RochaNov 11, 2008 3:40 am 
Edroaldo Lummertz da RochaNov 12, 2008 6:42 am 
Edroaldo Lummertz da RochaNov 14, 2008 3:46 am 
Timothy WallNov 14, 2008 4:37 am 
Edroaldo Lummertz da RochaNov 14, 2008 9:41 am 
Edroaldo Lummertz da RochaNov 14, 2008 10:05 am 
Timothy WallNov 14, 2008 11:31 am 
Edroaldo Lummertz da RochaNov 17, 2008 4:35 am 
Timothy WallNov 17, 2008 5:17 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] Structure by value and referenceActions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 7, 2008 4:44:26 pm
List:net.java.dev.jna.users

On Nov 7, 2008, at 6:22 PM, Edroaldo Lummertz da Rocha wrote:

Hello, I have the following problem: I have a struct like this:

struct HSymTbl { unsigned long pSymTbl; unsigned long length; }; and I need to call the following function:

int LoadUser_HL(void ** hDev,char * FilePath,struct HSymTbl * pSymTable);

This way, I just to use a Structure subclass and pass my Structure object by reference, is it correct? I do it and works fine, but after I need to call the following function:

K_Move_Data_HL(void ** hDev,BOOL RW,unsigned short Nb_Words, unsigned short * Buffer,signed long DSPAddress, int MemSpace,char * Symbol,struct HSymTbl SymTable);

and here, I need do pass a Structure by value. How can I do it? I have already tried to implement the interfaces Signature.ByReference and Signature.ByValue, but I can not understand how to use the Signature SymTable as a reference in a moment and as value in another moment. May You might help me please?

In this case you can use MyStructure.ByValue in both cases, as long as the function interface declares the appropriate usage. MyStructure.ByValue will work in the first function because it derives from MyStructure, and the function signature takes precedence over the actual type passed in (so the ByValue attribute is ignored in the first case).