[RLP] Passing byte arrays from C# into C -> size differs


I’m trying to pass 2 byte arrays from C# into C.
In the current test, the byte arrays are 480 bytes each.

I defined the following RLP function:

int SendData(unsigned char *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
	unsigned char *data0 = generalArray;
	unsigned char *data1 = (unsigned char*)args[0]; 
        int length = sizeof(data0);
        return length;

The result is always 4 (data0 has a length of 4 and so does data1)
Perhaps I’m simply using the wrong C function to get the length?

Anyway… the reason I’m trying to get the length is because
I want to make sure that the code does receive the byte[] I sent from C#
and didn’t know any other way to debug RLP code.

The idea is to have C# generate the required data and then
send that data to the gpio’s using C (for speed)

data0 and data0 are pointers to an unsigned char. On a 32 bit machine a pointer is four bytes long.

I have not used RLP. Is there a RLP library function to determine the length of a passed managed array?

Just write your own… its a simple do … while NULL loop…

Cheers Ian

argSize is the size of the array I believe

I am curious to know what device on other side of gpio needs data faster then what fez can supply. Normally, I have to slow changes down, rather then other way. Marshalling is not free either. I would be curious as to net savings here and if at the end of day it is even worth it?

Getting the size of the array was just to test something,
but I’ve figured out that part works.

The device on the other end are mbi chips connected to LED panels.
The managed runtime is not fast enough AND you really need “realtime” to control these devices properly… it requires nano-second precision.

Thnx for the replies people :slight_smile: