This code failed with error message Cannot 'importc' at compile time
import cpuinfo
var arr: array[countProcessors(), int]
Is there a way to get the processors count that will be used for creating an array?
@Vantage Yeah, I just realized now that you mentioned it.
@Stefan Yes, in my case, it is exactly like that. Have staging server which similar with production server.
Let me change question a bit, is there any example to make array during runtime?
If you really need to know the number of processors on a system, you could always compile a sub-program during compile-time and invoke it.
Regarding allocating arrays at runtime, is there a reason that a sequence won't work? You could technically do something by wrapping C's calloc, however that's not portable.
If you really need to know the number of processors on a system, you could always compile a sub-program during compile-time and invoke it.
Indeed I assumed that. But I have no idea how to do it in detail in a user friendly way -- so that user can still do a plain "nimble install myTool". Note that this is not limited to number of CPUs, we may be interested in available ram, GL version, GPU and much more at compile time.