View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Wed Jan 05, 2005 4:05 pm Post subject: Stack OverflowException |
|
|
I am attempting to call a fortran subroutine (in a .NET DLL) from a c# front end.
The fortran code works fine from within the Plato3 IDE on its own. But Visual studio gives a
"An unhandled exception of type 'System.StackOverflowException' occurred in Fortranbackend.dll"
I have shrunk the fortran subroutine down to following
SUBROUTINE LoadTest
REAL*8 HC(65341),HS(65341),CC(65341),CS(65341)
END SUBROUTINE
If I remove the above line and replace with smaller variable declarations, all is OK
This cannot be called from c# in Visual Studio Enterprise, but works fine in Plato 3 IDE.
Any Ideas what params I have to tweek in VS to be able to call my code.
Thanks
Mike
|
|
Back to top |
|
|
Mike
Joined: 05 Jan 2005 Posts: 4
|
Posted: Thu Jan 06, 2005 2:02 am Post subject: Stack OverflowException |
|
|
Just wanted to add my proper forums ID, now I have signed up (Previous message was posted before I joined the forums)
Thanks |
|
Back to top |
|
|
silverfrost Site Admin
Joined: 29 Nov 2006 Posts: 191 Location: Manchester
|
Posted: Thu Jan 06, 2005 10:59 am Post subject: Stack OverflowException |
|
|
The problem is that as the exception indicates you do not have enough stack space. Your arrays are taking 65341*8*4 bytes (2090912 bytes). I suspect your c# application has a smaller stack space limit than this -- from memory 1MB. You could try making the variables not stack based (i.e. make then common or in a module). Not sure if C# can increase the stack space.
------------
Administrator
Silverfrost Forums |
|
Back to top |
|
|
Mike
Joined: 05 Jan 2005 Posts: 4
|
Posted: Thu Jan 06, 2005 3:48 pm Post subject: Stack OverflowException |
|
|
Thanks for response. Dont really want to change the size of the arrays or re-jig the software, really need to use it as-is. However a bit of a crawl around the net and I found that you can re-size the stack size of the apps by using the
[big]EDITBIN.EXE /STACK:nnnnnnnn[/big] Utility.
Worked a treat. |
|
Back to top |
|
|
silverfrost Site Admin
Joined: 29 Nov 2006 Posts: 191 Location: Manchester
|
Posted: Thu Jan 06, 2005 5:13 pm Post subject: Stack OverflowException |
|
|
Excellent solution
------------
Administrator
Silverfrost Forums |
|
Back to top |
|
|
criga
Joined: 08 Sep 2005 Posts: 1
|
Posted: Thu Sep 08, 2005 10:31 am Post subject: Stack OverflowException |
|
|
Hi Admin,
you say "making the variables not stack based (i.e. make then common or in a module)".
How would you do that? Can you give an example or point to a reference ... I have the same problem with
parameter(maxne=45000,maxnn=25000,maxnz=30,maxnez=maxnz-1,
+ maxw=1000,maxpw=32,maxpt=2000,maxmk=10)
Thanks, Chris. |
|
Back to top |
|
|
|