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:Edroaldo Lummertz da Rocha (edro@gmail.com)
Date:Nov 10, 2008 12:17:34 pm
List:net.java.dev.jna.users

I am trying to develop a code for a DSP Signal Ranger. These board returns values as: 0 for successfull, -1 when cannot find the board, -2 when cannot load the kernel and so on. The first function, *Initialize_HL *return 0, and it means that is ok, the function LoadUser_HL (the second function that I need to call)also returns 0, and it is ok. I send an e-mail to the fabricant, and it tell me that, if these two functions worked fine, i.e, returns 0, every is ok untill here. But in *LoadUser_HL*, I when I initialize my Structure object, the return value is 0, but the my Structure object HSymTbl is not initialized, because I cannot find the symbols that I would be able to find (as _aicreg). So, I think that the problem is in the LoadUser_HL, but I dont get errors, and by messages that I get, everything looks like ok. The function where se symbol is not found is *K_Move_Data_HL*. The C++ source code is provided by fabricant, I do not have Visual C++ to compile it, but the executable provided works well. What can I do? Thank so much for help. Grateful!!!

2008/11/10 Timothy Wall <twal@dev.java.net>

The mappings appear to be correct. Does the example work in C? If so, at what point does the JAva vs C behavior differ? At what point do you see differing values for data?

On Nov 10, 2008, at 11:39 AM, Edroaldo Lummertz da Rocha wrote:

I have already changed it. I do not have the type long in my code, just

NativeLong, but it does not work. My Structure class is correct? My pointers are correct? Is it possible to use JNA with any DLL? Thank so much!!!

2008/11/10 Timothy Wall <twal@dev.java.net>

On Nov 10, 2008, at 10:00 AM, Edroaldo Lummertz da Rocha wrote:

Where the bold text is the functions of DLL that I need. I am going

to post the signatures of java functions and the C++ function, for comparasion. I cannot see the errors, the type mapping is correct? I do not get compiler errors and do not get execution error, just does not work.

C signatures

int Initialize_HL(PCHAR BoardID,void ** hDev); int 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);

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

Java Assignatures:

public interface SignalRangerInterface extends Library { public int Initialize_HL(String boardId, PointerByReference hDev); public int LoadUser_HL(PointerByReference hDev, String filePath, SignalRanger.HSymTbl pSymTable); public int K_Move_Data_HL(PointerByReference hDev, int rw, short nbWords, short[] buffer, long dSPAdrress, int memSpace, String symbol, SignalRanger.HSymTbl.ByValue symTable);

Change long to NativeLong for DSPAddress.

public int ExecUser_HL(PointerByReference hDev, long dSPAddress, String symbol, SignalRanger.HSymTbl.ByValue pSymTable);

Ditto here.