Software Archive
Read-only legacy content
17061 Discussions

Access Violation

Intel_C_Intel
Employee
204 Views
Hi,

I am having a problem with an Access Violation.
We have written a DELL (in Fort ran) which is used within another application. This application loads our DELL, and calls a subroutine, which performs a load of calculations and then returns.
In order to perform these calculations, the DELL routine requires values from the main application, and it gets these by calling functions within the main application. It can do this, because as part of the original call, the application passes across the addresses of the routines which the DELL can use.

I know this sounds complicated, but it does work (most of the time).

However, we have encountered a problem where after the main application has called the routine in the DELL a number of times we get an access violation.

The strange thing is that it always occurs after the same number of calls (approx 40).

We think that the instruction causing the access violation is somewhere within the Fort ran Run-time, but we cannot determine the cause of the crash.

Do you have any ideas what the problem might be?

Thanks
0 Kudos
3 Replies
Intel_C_Intel
Employee
204 Views
Just a note to point out that in the message I posted above , the spell-checker has made some changes I didn't expect it to, mainly chaning DLL to DELL.
0 Kudos
Steven_L_Intel1
Employee
204 Views
Oh, was that it? I was going to recommend you write a COMPAQ instead! :-)

Without seeing the actual application, it's impossible to diagnose this sort of problem. If I had to guess, it's that you have a mismatch in calling mechanisms, between C and STDCALL. What language is the main application written in? How is the DLL routine declared there, and how is it declared in Fortran?

Steve
0 Kudos
Intel_C_Intel
Employee
204 Views
I think my next step would be to try to get as much debugging information as possible. Normally in Compaq Fortran, it is possible to get thrown into the debugger at the exact point where the access violation occurs, which is a great help.

I would compile with all debugging aids switched on, and then just run the code from within the IDE. At the point where it crashes, you'll get the yellow arrow pointing to some code, though this is likely to be some assembler if it can't immediately find a corresponding source line.

You can then look at the call stack to find which of your routines it was in just before it made the fatal call. You can also use the context pull-down menu in the variables window.

If that fails, try single-stepping a few times. This sometimes gets you out of the assembler listing into Fortran.

If that fails too, then you might be reduced to putting in some strategic write statements to track the code's progress, then putting in a conditional breakpoint to trigger just before the point where the access violation occurs, and then single-stepping from that point onwards.

If you can't set a conditional breakpoint in the IDE, you can use the WINAPI call DebugBreak() ('use DFWIN') inside an IF block.

Hope this helps.

Ian
0 Kudos
Reply