10-15-2012 03:00 AM
Still haven't looked at your VIs due to version issues, but I finally had some time to look more closely at the C code, and now I can at least make an educated guess about the problem you're seeing. As I understand it, you're getting an error at xapi_getblock, probably due to the void ** pointer.
Does your documentation specify if, after dereferencing, you have a null-terminated string or (more likely) a fixed-size block? In either case, I would use the GetValueByPointer VI twice. The first call will return an I32 (or I64 on a 64-bit operating system) that is actually a pointer. Feed that value to a second instance that retrieves the actual data. If you have a null-terminated string, you can retrieve it as a string. If you have a fixed-size array, either retrieve one element at a time or use MoveBlock to get the entire array at once. Both these approaches are explained here: https://decibel.ni.com/content/docs/DOC-9091
10-17-2012 06:29 AM
Thanks
It worked. I passed void ** as a int32* and it returned an address. I then used GetValueByPointer to get the data. Thanks for the help.
11-16-2015 08:20 AM
Hi Khonzi
Trust you are well. I hope you are still able to assist as i see this topic was from 2012.
I'm having this exact issue with the Xapi driver as we speak. I have read your notes here, but I cannot seem to come right.
The GetBlock() method passes out a System.Byte*. You say you passed this to a Int32* and then used GetValueByPointer.vi. Can you explain what you mean by "passed this to a Int32*"? If possible a print image of this. I have everything working except this part.
Regards
Waz
11-16-2015 08:59 AM - edited 11-16-2015 09:05 AM
System.Byte does sound like a .Net datatype, so you are most likely in the wrong thread here. This is about using the Call Library Node to interface to the exported C interface from their DLL, not the .Net assembly through .Net node in LabVIEW.
If the type library of the .Net assembly would have been created proberly you should simply get back an Byte array in LabVIEW. Not sure what you really get back from your description. Attaching actual code to posts is always a good idea.
11-16-2015 09:01 AM
11-16-2015 09:07 AM - edited 11-16-2015 09:07 AM
While the APIs are similar, low level details about how pointers are handled will differ very much. In fact in .Net you usually don't have simple pointers anymore, unless the creator of the assembly decided to take some shortcuts and expose some underlaying low level unmanaged interface in his API.
11-16-2015 09:27 AM
11-16-2015 09:41 AM
Attach your code!
11-16-2015 10:01 AM
Hi
Attached is the code. I'm using Labview 2015. All the drivers and config files are in the zip file if you require to change the config file path or the dll path.
In the read case structure is the area that I'm having trouble with. I have done tried to pull the data out in 2 ways. One way with a for loop and a pointer vi and the other with the moveblock library. Both of which dont collect the right data and just point to random data. Please note i have played around alot with the types to try get something out so most likely there is a type issue here and there.
Regards
Waz
12-08-2015 02:08 AM
hi,
I am building the application using the xapi , how we can understand that whatever data is coming is the actual data .