- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am getting Runtime error (Severe<157> : Program Exception – access violation) in Fortran Console application using FORTRAN static library. I have tired commenting out Write statements but it gives error to next Write statement .
I have Parallel Studio XE2013 and Visual Studio 2010 installed on my laptop.
When I had all source files ( from which static library .lib file was created ) compiled within same project it runs fine without any issues.
Is there anything special I need to define/declare in console application file (console.f90)?
Anything special need to do in console file using static library?
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 has provided a very good clue as to the problem. It also explains why building from all source together works.
Your cim.lib is built with the STDCALL calling convention - the @n suffixes on the routine names tells me this. This was used by Compaq Visual Fortran. But Intel Visual Fortran defaults to the C convention. If you call a STDCALL routine but the caller thinks it is calling a C convention routine, the stack will be corrupted and lead to errors later in the code. My guess is that if you change the project property Fortran > External Procedures > Calling Convention to "CVF" and rebuild (also making the CIM_INIT change mentioned above), it will work.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, there isn't. I suspect something else was involved which you are not aware of. There may be some project settings different between your two projects. It isn't related to static libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am in loop for few weeks about this. I tried reading file instead of getting inputs from console but same result.
Any suggestion?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attach a ZIP of a project that shows the problem. (Do a Build > Clean on it first). We have no idea what your program looks like.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also please run in Debug Mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You don't provide the source of CIM.lib so it can't be debugged.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok. I need to get it from someone. Because I did not create .lib file
I need to find it and send you.
Can you Please delete .zip file I sent to you earlier?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just want to make sure that in order to give me feed back:
You need:
1. Project containing .lib file including source
2. Current project with source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The call to CIM_INIT in your main program contains eight arguments. However, the library contains symbols _CIM_INIT and _CIM_INIT@24, which suggests that CIM_INIT expects to be called with six arguments. Can you explain this inconsistency?
How was the library compiled?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yup. Good catch. I had different routine having 8 arguments. But correcting that (by having same number of arguments ) also results in same error.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did not create library some one else have created I am simply using it. By the way, I had tried creating library myself from same source files and I had same errors.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 has provided a very good clue as to the problem. It also explains why building from all source together works.
Your cim.lib is built with the STDCALL calling convention - the @n suffixes on the routine names tells me this. This was used by Compaq Visual Fortran. But Intel Visual Fortran defaults to the C convention. If you call a STDCALL routine but the caller thinks it is calling a C convention routine, the stack will be corrupted and lead to errors later in the code. My guess is that if you change the project property Fortran > External Procedures > Calling Convention to "CVF" and rebuild (also making the CIM_INIT change mentioned above), it will work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the library was created using a different version of IFort or perhaps a non-Intel Fortran compiler, or if it was not compiled from Fortran code, there may be compatibility issues. I compiled your main program using the library that you provided, using IFort 15.0.2, and again using IFort 15.0.4, using the IFort 32-bit command window. With both, the resulting EXE ran to completion with the data that you gave and using the default compiler options. With /Zi, instead, both versions gave me an EXE that crashed with
forrtl: severe (8): internal consistency check failure, file for_desc_item.c, line 631 Image PC Routine Line Source libifcoremd.dll 5F9FE955 Unknown Unknown Unknown libifcoremd.dll 5FA68063 Unknown Unknown Unknown libifcoremd.dll 5FA670CB Unknown Unknown Unknown Console_CIMTEST.e 01191A97 _MAIN__ 557 Console_CIMTEST.f90
It will be necessary to have the source code for the library in order to proceed further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried your suggestion and it seem to work. This was simple test and I have commented out many things. I need to test more complicated tests now.
Thank You so much for your help.
![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page