www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - DLL Function Export FP to Excel

I am writing Win32 DLL that exports functions to Excel. I use the Floating Point
Array Structure in C to pass Excel ranges :

typedef struct _FP
{
unsigned short int rows;
unsigned short int columns;
double array[1]; 
} FP;

I want to call the exported function from the dll:

extern __declspec(dllexport) void __stdcall SimpleExample(FP *arr){
for(int j=1;j<=5;j++){	
arr->array[j]=arr->array[j]*2;
}
}
(the range of cells is 5 long)


-directly in the Excel cells as an array formula via a declaration of the
function in VBA as opposed to using an .XLL:

Public Declare Function DLLFunction Lib "Mydll.dll" Alias
"?SimpleExample  YGXPAU_FP   Z"(ByRef outarr As Range) As Double

However Excel needs to know that the argument passed in is to be "modified in
place" and returned to the calling cells using the Return Type, in this case 1K
- first and only argument is a FP struct. If the function is registered in VBA
-where does this return type code information code go? - possibly in a ".def"
file?
May 04 2006