Main Site Documentation

Structures in RLP?


#1

Hi,

since our code required more speed, we switched into RLP using Gus useful pointers, now something else, inside RLP I can’t seems to work with structures only native types, any ideas why? my structures are very simple containing a few bytes and few unsigned shorts

Thanks


#2

@ liran.shahar - Can you give an example of the problem you are having? I have used structures extensively in RLP and RLPlite without any issues. Or are you trying to pass structures from managed code to the RLP code? That would not work, but if that is the issue, we could provide a few pointers.


#3

this is the case, i got an array of managed structures and data that comes from the CAN messages, i put it in a byte array and pass on to RLP code for some processing, I want to be able to fiddle with the data directly in the structures

any pointers will be appreciated.

Thanks


#4

@ liran.shahar - I suspect that MF does not support the necessary metadata to control the alignment of variables within a struct. If a struct was to be passed, that alignment in the managed world and C world must be identical.


#5

as far as I know this code should work :

[StructLayout(LayoutKind.Sequential)]

so I am not sure there is an issue there, but I can’t even test that before I manage to define a proper structure in the C RLP file, which currently keeps on giving me error, do you have a sample of RLP file that defines structures in it? I would appreciate that

after that I can check if the memory from the managed structure is “mapped” properly in the C code


#6

@ liran.shahar - any book on C will show you how to define a struct. you can post your definition and error message.