In C and C++, when you use an C array as parameter of a function, then the 
compiler automatically passes a pointer to the first element.

In Nim, we may define our functions in a way that arrays and seqs are of type 
open array, so we can pass them directly. But if your function expects a 
pointer, then you may have to use addr operator and maybe additional a cast. 
Maybe something like
    
    
    var imgdata = [0, 0] # array, use @[0, 0] for a seq
    var image = iupImageRGBA(32, 32, cast [MyDesiredType](addr(imgdata[0]))) # 
should work for array and seq
    
    var image = iupImageRGBA(32, 32, cast [MyDesiredType](addr(imgdata))) # 
works for array only
    
    
    Run

Reply via email to