numChildrenReturn: Pcuint
Run
is wrong, you need to allocate storage for it. I would use:
numChildrenReturn: cuint
RunAnd then `addr(numChildrenReturn)` in the call to `XQueryTree`. And frankly, such a mistake indicates that you're not ready for X11's low level API. Read some tutorial about Nim's memory model and what to watch out for when interfacing with C.
