Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

open or write of unit 6 fails in ivf11 but works in ivf9

Michel
Beginner
1,034 Views
I'm upgrading our codebase from ivf9.1 to ivf11.1

A few of our apps write errors to unit 6. This failes when compiled with ivf11.1
I have one DLL wich passes error strings to the calling app wich failes when it tries to sent an errorstring.
It also failes on the open statment, which is:
open(6,file='con',carriagecontrol='list')

I did find one post about accessing the console and it suggested that it was fixed in the latest compiler build.
So I upgraded to ivf11.1.046 but that one failes in the runtime library dll (see other post)

Is this something that will be fixed? or do I have to chance my code.
0 Kudos
8 Replies
tropfen
New Contributor I
1,034 Views
Quoting - Michel
I'm upgrading our codebase from ivf9.1 to ivf11.1

A few of our apps write errors to unit 6. This failes when compiled with ivf11.1
I have one DLL wich passes error strings to the calling app wich failes when it tries to sent an errorstring.
It also failes on the open statment, which is:
open(6,file='con',carriagecontrol='list')

I did find one post about accessing the console and it suggested that it was fixed in the latest compiler build.
So I upgraded to ivf11.1.046 but that one failes in the runtime library dll (see other post)

Is this something that will be fixed? or do I have to chance my code.

Sorry forget the following open a unit 6 should work.

Frank

Hello,

as far as i know unit 6 is the preconnected towards the screen. I am not sure if it is allowed to open a file unit with the number 6.

May be there was no checking for this in ivf 9 .

Frank

0 Kudos
Michel
Beginner
1,034 Views
Quoting - tropfen

Sorry forget the following open a unit 6 should work.

Frank

Hello,

as far as i know unit 6 is the preconnected towards the screen. I am not sure if it is allowed to open a file unit with the number 6.

May be there was no checking for this in ivf 9 .

Frank


We are doing this since DEC/HP fortran and it was never a problem.
And I really don't want to go trough 9k source files to change this...

Michel.
0 Kudos
anthonyrichards
New Contributor III
1,034 Views
Quoting - Michel

We are doing this since DEC/HP fortran and it was never a problem.
And I really don't want to go trough 9k source files to change this...

Michel.

open(6,file='con',carriagecontrol='list')
WRITE(6,'(A100)') 'Hello, world!'

compiles and runs ok for me using IVF 11.1.035
0 Kudos
Steven_L_Intel1
Employee
1,034 Views
I don't know of any problem, unless there is no console window available.
0 Kudos
Michel
Beginner
1,034 Views
I don't know of any problem, unless there is no console window available.

There is a console window open where we write some tracing data to.
I traced it back to the call to for_rtl_finish_() This call gives an error on unit 6.
When I do not call this function the dll app does not crash on unload.

The main DLLis c code withch uses fortran functions.

Michel.
0 Kudos
Steven_L_Intel1
Employee
1,034 Views

What is _rtl_finish()? I don't recognize it. Can you provide us with a test case? Is the executable linked to the Fortran DLL libraries?
0 Kudos
Michel
Beginner
1,034 Views

What is _rtl_finish()? I don't recognize it. Can you provide us with a test case? Is the executable linked to the Fortran DLL libraries?

If you call a fortran app from c you have to initialize the fortran environment, and when you want to close your app you have to close the fortran app before you end your main c app.
You then call _for_rtl_finish() from c. (this is a standard fortran library call)
Since the c app is a DLL wich calls fortran routines we make a call to _for_rtl_finish() before the DLL unloads.
If our app is compiled with ivf9 then several files stays opened and/or locked until this call.
Now it seems that compiled with ivf11 and omitting this call all files are closed when the DLL unloads.

So this behaviour has changed.

Michel.
0 Kudos
Steven_L_Intel1
Employee
1,034 Views
Ok, I am informed that you are calling for_rtl_finish. Fine. If you have a C DLL called from Fortran, both the C and Fortran code must be linked to the DLL form of the Fortran (and C) run-time libraries (and the same form, debug or non-debug). If you end up with two copies of the Fortran (or C) run-time library in the address space, trouble will follow.
0 Kudos
Reply