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

Error while trying to write to a file

ferrad01
Beginner
886 Views
I have a bit of code that opens a file for reading, reads from it, rewinds to the beginning and then starts writing to it. It seems a bit strange to me, but that code has been there for ages and works fine.

However I have just built a new DLL which uses this code, and when I try to do the writing, I get:

forrtl: severe (47): write to READONLY file, unit 19, file...

I'm trying to find out what causes this problem, I can only think it has something to do with complier options, but I can't see which one it is.

Can anyone help?
0 Kudos
2 Replies
Steven_L_Intel1
Employee
886 Views
If you are just now moving this code into a DLL, make sure that the executable that uses it is linked against the DLL run-time libraries. (In Fortran, this is Libraries > Use Runtime Library > Multithreaded DLL.) This setting must match the one used for building the DLL. If you don't, then the EXE and DLL don't know about each other's units.
0 Kudos
ferrad01
Beginner
886 Views
Thanks Steve, I got it sorted out.
0 Kudos
Reply