Click to See Complete Forum and Search --> : Why Stack Overflow???Help!!!!!!!!!!


sailorfan
August 31st, 2005, 05:39 PM
Hi, there,

I generated a .dll library using managed C++ within .NET framework.

A C# console application was used to test functions in .dll (generated by managed C++).
There is a function "func001" in .dll allocates unmanaged array: double *aa= new double[size];
It always gives me a crash "Fatal Stack Overflow Error", even if size==3.

The problem seems have no trouble to allocate managed arrays. I really do not know why. Please kindly help.

In C#:

...
NS01.Cls01 mycls = new NS01.Cls01();
mycls.Func001(...);
...


The .dll library in managed c++ is like:

namespace NS01
{
void Cls01::Func001(...)
{
...
size = (int)(30.3/1.34);
double *tt = new double[size]; // it would not execute this one
...
}
}


Why could "Fatal Stack Overflow Error" happen? There is much memory needed.
I really do not know why. Could anyone please help?
Thank you so much.