I have a visual studio c++ solution containing two projects; an xll and a dll (called 'main'). The 'main' dll exports one simple function, like this
#pragma once
// Just for testing exporting from the dll
#ifdef MAIN_EXPORTS
#define PAMAIN_API __declspec(dllexport)
#else
#define PAMAIN_API __declspec(dllimport)
#endif
extern "C" PAMAIN_API double add(double x, double y);
My xll works fine when it doesn't call the new 'add' function. I then try writing the line of code
double z = add(1, 2);
anywhere within my xll project. The whole solution builds and links. But now when I import the generated xll into excel, I get error message The file format and extension of xll.xll don't match
What can the problem possibly be?
Thank you
By saving the xll and dll in various locations, I established that the xll and dll are fine, but excel doesn't always know where to load the dll from, and when it doesn't it gives the "The file format and extension of xll.xll don't match" error.