You need to create fake xlcall32.dll , put it in the same directory as your XLL (do not put excel's own xlcall32.dll in PATH). Here is the code:
# include <windows.h> typedef void* LPXLOPER; extern "C" void __declspec(dllexport) XLCallVer ( ) {} extern "C" int __declspec(dllexport) Excel4 (int xlfn, LPXLOPER operRes, int count,... ) { return 0; } extern "C" int __declspec(dllexport) Excel4v(int xlfn, LPXLOPER operRes, int count, LPXLOPER far opers[]) {return 0;}
Now suppose I have an XLL called xll-dll.xll with a function called (use "depend.exe" to find out the names of the exported functions) xlAdd, which adds two doubles well: extern "C" __declspec (dllexport) XLOPER * __cdecl xlAdd (XLOPER * pA, XLOPER * pB);
The following code calls it:
# include <windows.h>
My exe actually works (in my own surprise) and outputs 3 as expected. You should have some idea of what your XLL expects from options. If it allocates some memory, you should check if #define xlbitDLLFree 0x4000 is installed on your type XLOPER c-> and calls back "xlAutoFree".
reder
source share