View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
William C Bonner William C Bonner is offline
external usenet poster
 
Posts: 3
Default O% Data Type Problem in C API and Excel12

I'm trying to update a set of routines that I had working in older excel to
allowing them to work with larger arrays in the new excel.

I've updated my routines to work with XLOPER12 instead of the older XLOPER
formats. In the past my function was registered with a set of parameters that
looked like "ROO" and I'm trying to use the new parameters of "UO%O%$".

In C, the old and new procedure definitions looked like:

LPXLOPER __stdcall cplxSum(unsigned short int *iNumXLRowsA,unsigned short
int *iNumXLColumnsA, double A[],unsigned short int *iNumXLRowsB,unsigned
short int *iNumXLColumnsB, double B[])

LPXLOPER12 __stdcall cplx12Sum(signed int *iNumXLRowsA,signed int
*iNumXLColumnsA, double A[],signed int *iNumXLRowsB,signed int
*iNumXLColumnsB, double B[])

I've been looking at http://msdn.microsoft.com/en-us/library/bb687900.aspx
as to the differences in the new SDK.

The values getting passed in the array A[] or B[] were incorrect when the
second version of the function was registered. In the debugger, I was able to
figure out that the address of those arrays was off by 4 bytes. If I
manually insert this hack, things seem to be working.

// HACK: Total HACK!
char * foo = (char *) A;
foo -= 4;
A = (double *) foo;
foo = (char *) B;
foo -= 4;
B = (double *) foo;
// HACK: End of total hack.

Has anyone else run into problems with the O% Data Type? Is there something
inherently wrong that I'm doing that's causing this behavior?