DLL that returns array

 
I have written a simple DLL that processes an array and returned it to MT4


float* getArray(float* input)
{
//
//
//
// Process
//
//

return value;
}


How do I import the DLL and make use of it?
Am I allowed to use pointers in MQL4?



#import "test.dll"
float* getArray(*float input);
#import



Thanks in advance
 
As far as I know you cannot return an array back to mql4 code. At least I couldn't succeeded in doing that.
An easy solution is to create an array in mql4 and pass it as a method parameter. Then the method inside the dll can assign values to the array that will be accessible from mql4.
 
you must pass the array by reference. Even in pure mql4 it is not allowed to return any other things than double, int or string as return vaues. Returning arrays can only be achieved by passing as argument by reference.

in mql you declare it like

void foo(double &bar[]);

and in your DLL you will receive a pointer to an array of double. You can then dereference this and read and write to this array.
 
Yes, you are right.
But this way was not suitable for me because I use .NET dlls and allocating unmanaged memory is impossible (or at least an overkill) from .NET.
So if you write unmanaged code it is better to follow 7bit's way.
Reason: