Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xll functions are not recognized by excel #10

Open
MisesEnForce opened this issue Jun 27, 2022 · 4 comments
Open

xll functions are not recognized by excel #10

MisesEnForce opened this issue Jun 27, 2022 · 4 comments

Comments

@MisesEnForce
Copy link

MisesEnForce commented Jun 27, 2022

I git-cloned the CompFinance repo, built the solution with visual studio 2022 without any issue -- I just had to upgrade the windows SDK etc. (I built in debug x64 and my office 365 excel is x64 as well.)

Then I added the XLL to a blank excel file, in which I opened the test spreadsheet xlTest.xlsx.

Then, I see "#NAME?" in any cell using a function of the XLL in a formula.

These functions do not seem to be recognized by excel. (The same problem happens when building the debug xll in x86.)

I then put a breakpoint L1261 in the xlLExport.cpp file (the "entry point" of the XLL) and attached visual studio to a blank excel spreadsheet process, spreadsheet to which I added the debug x64 XLL. It indeed broke at the breakpoint I put.

The L1263 call to Excel12f worked like a charm. The L1265 call to Excel12f led to a #ifdef _WIN64 when one return(xlretFailed); Clearly, the code is x86 designed ...

The explains why all the XLL functions are not recognized by Excel, for the x64 XLL.

The #else of the #ifdef _WIN64 seems to have valid code, so I have redone the very same that preceeds, but in x86. Here, I didn't even break in the entry point ...

As I am no IT nor an XLL expert, I would be glad would someone point to a valid correction.

@MisesEnForce MisesEnForce changed the title #NAME ? in the xlTest.xlsx spreadsheet xll functions are not recognized by excel Jul 1, 2022
@Mjang714
Copy link

yeah I noticed the same thing... ugh the woes of trying to compile 64 bit stuff....

@Mjang714
Copy link

Mjang714 commented Aug 9, 2023

okay is this still an issue for you?

@terlal1
Copy link

terlal1 commented Apr 10, 2024

To fix this for x64, first remove the two #ifdef _WIN64 portions from xlcall.cpp and the corresponding #endifs.
Then, the real fix is on line 32 of xlframework.h.
Change the type of count from int to size_t.

@terlal1
Copy link

terlal1 commented Nov 21, 2024

While the above fix works for x64, it doesn't work for Arm64EC, which is the platform required for excel addins in Windows on Arm.

The following implementation of Excel12f seems to work everywhere:

template<typename... E>
int Excel12f(int xlfn, LPXLOPER12 pxResult, size_t count, E ...e)
{
int xlret;
if constexpr (sizeof...(e) == 0) {
xlret = Excel12v(xlfn, pxResult, count,nullptr);
}
else {
LPXLOPER12 lpx[] = { e... };
xlret = Excel12v(xlfn, pxResult, count, lpx);
}
FreeAllTempMemory();
return xlret;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants