- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am migrating from CVF to IVF12 using Visual Sudio 10. I have a third party executable program that calls a DLL which I created. The DLL, in turn, links to a static library which I also created. Both the DLL and the static library (LIB)were compiled using IVF. The DLL and the LIB are each composed of many subroutines. I wanted to make a minor change in a subroutine of the LIB that would be valid only for this DLL and not for other programs. So I copied this subroutine to the DLL using the same name that it has in the LIB. This copied subroutine contains the same common blocks as other routines in the LIB.
When I obtained results that were incompatible with those that I expected, and different from those I had obtained previously using CVF with identical procedures, I found with the aid of the debugger that when the copied subroutine is entered, all variables in the common blocks had lost their values which had been defined/calculated in the LIB. That is, the call from the DLL to the LIB was fine, and the call from the LIB to the copied subroutine in the DLL was also fine, but the variables in all the common blocks had lost their values. Since this worked okay in CVF, I assume that there's some switch that needs setting in IVF. Any help would be greatly appreciated.
When I obtained results that were incompatible with those that I expected, and different from those I had obtained previously using CVF with identical procedures, I found with the aid of the debugger that when the copied subroutine is entered, all variables in the common blocks had lost their values which had been defined/calculated in the LIB. That is, the call from the DLL to the LIB was fine, and the call from the LIB to the copied subroutine in the DLL was also fine, but the variables in all the common blocks had lost their values. Since this worked okay in CVF, I assume that there's some switch that needs setting in IVF. Any help would be greatly appreciated.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"So I copied this subroutine to the DLL using the same name..."
That is a misleading and incorrect statement. You cannot copy source code into an executable object. Furthermore, changes to the source code used to produce the DLL have no effect on either the static library or the DLL unless each of them is rebuilt using the changed dependencies.
That, however, I suspect not to be your problem. CVF and IFort have different default settings, as described in the article Migrating from CVF . In particular, see if the option /Qsave will take care of the problem for now.
In modern Fortran, common blocks that are out of scope are not saved unless you explicitly declare them with the SAVE attribute. You should consider converting those common blocks to modules.
That is a misleading and incorrect statement. You cannot copy source code into an executable object. Furthermore, changes to the source code used to produce the DLL have no effect on either the static library or the DLL unless each of them is rebuilt using the changed dependencies.
That, however, I suspect not to be your problem. CVF and IFort have different default settings, as described in the article Migrating from CVF . In particular, see if the option /Qsave will take care of the problem for now.
In modern Fortran, common blocks that are out of scope are not saved unless you explicitly declare them with the SAVE attribute. You should consider converting those common blocks to modules.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting mecej4
In modern Fortran, common blocks that are out of scope are not saved unless you explicitly declare them with the SAVE attribute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved. My fault. I had an array dimensioned differently in the copied subroutine from its dimension in the static library. Corrected that and it now works. Evidently it had nothing to do with dll's, libs or common blocks.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page