Passing pointers/references to #import functions.

 
Would it be possible to define parameters to an external function as const and allow High/Low/Open/Close to be passed to the function?

As it stands right now I have to copy it to another array when I should just be able to pass the reference directly instead.
Like this:
#import "math.dll"
  void sse_iC(const double& high[], const double& low[], double& results[]);
#import
  sse_iC(High, Low, array); //Right now fails since you cannot pass High or Low.



Currently you cannot pass those constant arrays but it would be really useful.

Also, currently if you try to pass the pre-defined arrays (High/Low/Open/Close) just as an array not as a reference it passes a null pointer instead, but doesn't issue an error or warning. If it is just going to reject them being passed in that situation shouldn't it also warn people?

Thank you for your time.

 
void sse_iC(double high[], double low[], double& results[]);
 
When using: void sse_iC(double high[], double low[], double& results[]);
If you call sse_iC(High, Low, array) then:
high == NULL, low == NULL

DLL code for example:
int __declspec(dllexport) __stdcall sse_iC(double High[], double Low[], double result[])
{
	if(High == NULL || Low == NULL) {
		return -1;
	}	
	if(result == NULL) {
		return -2;
	}
	return 1;
}


Expert code:

#import "math.dll"
  int sse_iC(double h[], double l[], double& result[]);
#import
double lret[];
double low[100], high[100];

void init()
{
   int ret = sse_iC(High, Low, lret); //Call #1
   Print("#1 return value is: ", ret);
   
   ret = sse_iC(high, low, lret); //Call #2
   Print("#2 return value is: ", ret);   

   ArrayResize(lret, 10);
   ret = sse_iC(high, low, lret); //Call #3
   Print("#3 return value is: ", ret);   

   return;
}



Output is:
2005.08.08 07:24:36 sr EURUSD,H1: #3 return value is: 1
2005.08.08 07:24:36 sr EURUSD,H1: #2 return value is: -2
2005.08.08 07:24:36 sr EURUSD,H1: #1 return value is: -1

Thank you for your time.

 
oh i see. i've forgotten that timeseries are special redirected arrays. use ArrayCopyRates and pass 2-dimensional array to your dll-functions. ArrayCopyRates was developed especially for such purpose. see our ExpertSample dll
 
Ah ok I see, I guess that works just as good.