to an address like 0x40028000
Thanks, Mark
The addr <https://nim-lang.org/docs/system.html#addr>_ proc returns a ptr T which can be cast into int.
type
Usart = object
cr: int
var x: Usart
echo cast[int](addr x)
That's not how I understood the question. Here is my solution:
type
Usart = object
cr: int
template a(): ptr Usart = cast[ptr Usart](0x40028000)[]
a().cr = 1234
(*(*((tyObject_UsartcolonObjectType__XTl78bMn519bCizK6Y69cOpQ**) 1073905664))).thr = ((NI) (((NU8)(c))));
If I remove one level of indirection in the c code, it works as expected. Mark.