Hi, I have a routine that takes an array of numbers (of type "extended"), performs some computations, and returns a value. Let's call this routine R and put it into its own unit, UnitR.
I'd like to use routine R in any of several projects. But those projects, while using arrays of type extended, define the arrays of different lengths, e.g., one might define MyArray : array[1..500] of extended while another might have AnotherArray : array[1..750] of extended. I'd like to include my UnitR into the "uses" of any of my projects, and not have a fixed array size in R's code that I'd have to change to match whatever the calling routine is sending. It seems I should pass the array to R using a pointer to the calling routine's array and an integer parameter indicating the number of elements in the array. My question(s): 1. Is this the correct approach? And if so... 2. What is the syntax for (1) the calling routine, and (2) routine R. For example, if R (which is an object) has a method, ComputeValue, should it be defined as function ComputeValue ( P : pointer; N : integer ) : extended; and if so, how would I access element [J] of the calling program's array? How would the calling program pass its array, say MyArray : array[1..500] of extended, to R? Would it be: MyResult := ComputeValue( @MyArray, 500 ); ?? Thanks in advance, -- Stan _______________________________________________ Delphi mailing list -> Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi