I'm not sure, but it sounds like you have arrays and the size of the array needs to be specified. I remember I had this type of problem when working with Matlab code blocks in Simulink. I had input signals that were vectors of size that could change based on a parameter. In other words, if N=4, then the vector would be of length 4. But, I was forced to code a maximum size for those vectors within the code block itself. For example, I would initialize the vector size as 500 by setting all values to zero, and then only calculating the values of the first 4. Then on the output side, within Simulink, I used a demux block that picked out only the first 4 elements of the vector. The demux block let me have variable size for the output vector.
Perhaps you have a similar issue.