Just for the benefit of anyone else that is searching the NI site with the same problem:
I just gotten my NI USB-8476 LIN interface to work successfully read some LIN data in my .NET application. This was difficult, because many pointers passed to/from the DLL's are of type "As Any", no longer allowed in VB.NET.
VB will not allow you to just call this "As Object". If you tell VB to return a pointer to structure of type NCTYPE_CAN_STRUCT, it should work, because that is in fact what it is pointing to. But, alas, it does not. VB gives you protected memory errors. Now, perhaps a better programmer than I can come up with a cleaner solution, but this is how I got it to work:
ncRead woulds still allow me to get the data out as an array of bytes. I did so, and parsed the ones I needed into the structure. Code:
Status = ncRead(LINRx, AllottedDataSize, ByteBuffer(0))
If Status <> 0 Then GoTo RecError
'Public Structure NCTYPE_CAN_STRUCT
' Dim Timestamp As NCTYPE_UINT64 (Bytes 0 - 7)
' Dim ArbitrationId As Integer (4 Bytes, so Bytes 8, 9, 10, 11)
' Dim FrameType As Byte (Byte 12)
' Dim DataLength As Byte (Byte 13)
' <VBFixedArray(7)> Dim Data() As Byte (Bytes 14, 15, 16, 17, 18 19, 20, 21)
'End Structure
Dim ReceiveStruct As NCTYPE_CAN_STRUCT
ReceiveStruct.Initialize()
ReceiveStruct.ArbitrationId = ByteBuffer(8) + ByteBuffer(9) * 256 _
+ ByteBuffer(10) * 65536 + ByteBuffer(11) * 256 * 65536
ReceiveStruct.FrameType = ByteBuffer(12)
ReceiveStruct.DataLength = ByteBuffer(13)
For i = 0 To 7
ReceiveStruct.Data(i) = ByteBuffer(14 + i)
Next