7:07 AM
c0170 has quit
7:08 AM
c0170 joined the channel
12:02 PM
errordeveloper joined the channel
12:27 PM
errordeveloper has quit
13:17 PM
errordeveloper joined the channel
13:45 PM
errordeveloper has quit
14:42 PM
errordeveloper joined the channel
14:46 PM
errordeveloper has quit
14:56 PM
errordeveloper joined the channel
16:10 PM
errordeveloper has quit
16:14 PM
errordeveloper joined the channel
16:15 PM
c0170
stil lhavent figured out how to allocate that space for C library objects .. still 0 :/
16:25 PM
errordeveloper has quit
16:33 PM
errordeveloper joined the channel
18:10 PM
errordeveloper has quit
19:24 PM
errordeveloper joined the channel
19:38 PM
bgamari
c0170, what are you trying to do?
19:41 PM
c0170
19:41 PM
zinci
19:41 PM
c0170
I asked on stackoverflow to get ideas
19:42 PM
need to allocate runtime sized object which then retype to C type object.
19:55 PM
bgamari
c0170, it's really runtime sized?
19:55 PM
you don't know the size at compile time?
20:01 PM
c0170, I'm not sure I follow your issue here
20:01 PM
c0170, init() in this case will produce a zero-initialized array of four u8s
20:01 PM
it seems to me that is exactly what you are seeing
20:02 PM
c0170
I am seeing that gpio is a pointer to 0
20:02 PM
bgamari
rather, init() will produce a zero-initialized reference to an array of four u8s
20:03 PM
c0170
have to run ,be back
20:03 PM
bgamari
c0170, that is what you should be seeing
20:03 PM
c0170
I shared disassembly there of the function new
20:04 PM
bgamari
c0170, yes, I see that
20:04 PM
c0170, it is correct
20:04 PM
c0170, You are misunderstanding what init does
20:04 PM
c0170
probably yes
20:04 PM
I had to initialized that array so I found init()
20:04 PM
what other options are there? have to look for
20:05 PM
bgamari
it's not producing an array
20:05 PM
it's producing a reference to an array
20:05 PM
c0170, you need to provide room for the C data structure within your Rust type
20:06 PM
unless you want to use dynamic allocation
20:06 PM
which is best to avoid in this case
20:06 PM
c0170, as you almost certainly know the size of the C data structure at compile timme
20:08 PM
20:20 PM
farcaller, fixed shiny for you
20:20 PM
farcaller
it was broken?
20:21 PM
:(
20:21 PM
thanks
20:52 PM
errordeveloper has quit
21:02 PM
errordeveloper joined the channel
21:55 PM
c0170
bgamari: no dynamic allocation, and yes its compile time but for each target different... so gpio_type for freescale might be 4 bytes, for silabs 20bytes
21:56 PM
bgamari
c0170, ugh
21:56 PM
c0170, what library are you using?
21:56 PM
c0170
there can be a function call, get_gpio_size() which returns sizeof(gpio_type) for the target
21:56 PM
mbed :-)
21:56 PM
bgamari
c0170, I believe you need to know the size at compile to do static allocation
21:56 PM
c0170
:(
21:57 PM
bgamari
c0170, CPP magic could work around this
21:57 PM
c0170
what do you mean CPP magic?
21:58 PM
bgamari
#ifdef PLATFORM_FREESCALE
21:58 PM
#define GPIO_SIZE 4
21:58 PM
#else ...
21:58 PM
c0170
yes, that could be.. dont want to do that at first
21:58 PM
as library is changing
21:59 PM
and maintain all those defines might be a nightmare
21:59 PM
but for now can do that
22:02 PM
going to get some sleep, thanks bgamari ;) talk to u later
22:03 PM
one more question, for preprocessor magic usage, how that work in the rust world?
22:03 PM
bgamari
you'd need to send your rust sources through CPP
22:04 PM
c0170, alternatively you could
22:04 PM
write a macro
22:11 PM
c0170 has quit
22:14 PM
farcaller
"send your rust sources through CPP"
22:14 PM
"left IRC"
22:14 PM
:-D