XLL addin crashing Excel

Hi, I tried posting this in the beginner's forum but haven't got any response yet, hopefully someone here can help?

I have tracked the troublesome code to the lines printed below.

Basically, I have a function called "MinMW" and within this function I have this call:

1
2
3
4
5
double* vals = new double [37];

Station.Parameters(vals,Temp,.......); // Long list of arguments

double TotalPower = vals[0];


The "Parameters" function is this:

1
2
3
4
5
6
7
8
9
10
11
int Station::Parameters(double *vals, double Tamb, ........) {

// Lots of code, skip to important bit

vals[0] = 123.4;
// ...
vals[36] = 123.4;

return 1;

}


There are no errors from Visual Studio 2010 when building the XLL, but Excel crashes whenever "MinMW" is called.

Any ideas would be gratefully received.
Have you tried debugging the program to see where it crashes?
This can happen when you step on out of bounds memory. Why not use std::vector<double> vals(37)?

If you are creating xll's, you should definitely check out http://nxll.codeplex.com . It makes the process much easier. The library does memory checking when compiled in debug mode.
Last edited on
Topic archived. No new replies allowed.