sized array of float as parameter to nvidia cg shader

I am trying to use Cg shaders to blend textures within a fragment shader. I want to set weights for each image that i would like to pass down to the shader as a uniform variable of float arrays. These weights are fixed array of floats that would be reset variably. Is this possible? I see there is a method cgGLSetParameterArray1f(CGparameter, int offset, int nelements, float* values) and a method CgSetActiveSize(CGparameter param, int size).

Even though i use these methods i get errors while creating the shader using CgCreateProgram().

Is it possible to do what i am trying to achieve and can someone give me or point me to a sample code? even rough snippets of code or pointers would do.

If this is accomplishable in glsl, then I surmise that there must be something similar in cg as well..so please let me know how its done in glsl too so that i can search for its counterpart in cg too

i figured out how to accomplish what i was seeking...Just in case someone else stumbled into this , heres what i did:

cg runtime actually allows you set a size the size of an array. So you would need to :

* create an array using cgCreateParameterArray{fr}(..)
* get the name of the parameter from the shader program using cgGetParameterName(...)
* set the size of the unsized array variable using cgSetArraySize(..)
* connect the created parameter to the parameter you just got with previous step, using cgConnectParameter(...)
* re-compile the program and load using cgCompileProgram(...) and cgLoadProgram(...).

It is to be noted that most of the operations of resizing the array is done by the cg runtime, so as per the documentation, it is recommended to set the compilation mode in cg to manual using cgSetAutoCompile(...)