I’ve lost track of the number of times I have had to search for this.
So now its going in a post.
| Data type | Pass by value | Pass by ref (pointer) | Comments |
|---|---|---|---|
| Boolean | A | L | short (0=false or 1=true) |
| double | B | E | |
| char * | C, F | Null-terminated ASCII byte string. | |
| unsigned char * | D, G | Length -counted ASCII byte string. | |
| unsigned short * (starting in Excel 2007) |
C%, F% | Null-terminated Unicode wide character string. | |
| unsigned short * (starting in Excel 2007) |
D%, G% | Length-counted Unicode wide character string. | |
| unsigned short [int] | H | WORD | |
| [signed] short [int] | I | M | 16-bit |
| [signed long] int | J | N | 32-bit |
| Array | O | Passed as three arguments by reference:
|
|
| Array
(starting in Excel 2007) |
O% | Passed as three arguments by reference:
|
|
| FP | K | Floating-point array structure. | |
| FP12
(starting in Excel 2007) |
K% | Large grid floating-point array structure. | |
| XLOPER | P | Variable-type worksheet values and arrays. | |
| R | Values, arrays, and range references. | ||
| XLOPER12
(starting in Excel 2007) |
Q | Variable-type worksheet values and arrays. | |
| U | Values, arrays, and range references. |
The types C%, F%, D%, G%, K%, O%, Q, and U were all new in Microsoft Office Excel 2007 and are not supported in earlier versions. The string types F, F%, G, and G% are used for arguments that are modified-in-place. When XLOPER or XLOPER12 arguments are registered as types P or Q respectively, Excel converts single-cell references to simple values and multi-cell references to arrays when it prepares them.
P and Q types always arrive in your function as one of the following types: xltypeNum, xltypeStr, xltypeBool, xltypeErr, xltypeMulti, xltypeMissing, or xltypeNil, but not xltypeRef or xltypeSRef because these are always dereferenced.
Type O, which is really three arguments on the stack, was introduced for compatibility with Fortran DLLs where arguments are passed by reference. It cannot be used to return a value except by declaring the argument as a modify-in-place return value and placing the results in the referenced values. Type O% extends type O in Excel 2007 so that it can access arrays that cover areas larger than the Office Excel 2003 grid.
So lets hope I can remember the search term eh?
cheers
Simon
Monday, 31st January, 2011 at 5:46 pm |
Just what I (really really) needed. Pasting this onto a sticky note right now, thanks!
Tuesday, 15th March, 2011 at 3:49 pm |
I just #define XLL_BOOL “A” … #define XLL_LPXLOPER “P” in a header file that I include. You can then use the C preprocessor string pasting to write, e.g., XLL_BOOL XLL_LPXLOPER to produce “AP” for a function that returns a BOOL and takes an LPXLOPER.
Here is a link to a file with these #defines: http://xll.codeplex.com/SourceControl/changeset/view/5592#74319