Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
17060 Discussions

error by file read in dll subroutine with in main opened File

Intel_C_Intel
Employee
524 Views
Hi

I have got a Problem with my Compaq Visual Fortran 6.6A.
I open a ASCII file in then console main program.

PROGRAM TEST_MAIN
IMPLICIT NONE
INTEGER CHANAL
CHARACTER CSTRING * 132
CHANAL = 99
OPEN ( CHANAL , FILE = 'TEST.DAT' )
CALL READ_STRING ( CHANAL , CSTRING )
WRITE ( 6 , "(A)" ) CSTRING
CLOSE ( KANAL )
STOP
END

In a DLL subroutine I will read a character-string from opened chanal.
The subroutine is exported by a modul definition file (TEST.DEF )

SUBROUTINE READ_STRING (CHANAL , CSTRING )
IMPLICIT NONE
INTEGER CHANAL
CHARACTER CSTRING * (*)
READ ( CHANAL , '(A)' ) CSTRING
RETURN
END

I got following error message.

forrtl: severe (29): file not found, unit 99, file H: estfort.99
Image PC Routine Line Source
DFORRTD.DLL 00234BD9 Unknown Unknown Unknown
DFORRTD.DLL 00234A39 Unknown Unknown Unknown
DFORRTD.DLL 00233C04 Unknown Unknown Unknown
DFORRTD.DLL 0023403A Unknown Unknown Unknown
DFORRTD.DLL 002644E8 Unknown Unknown Unknown
Test_DLL.dll 10001040 READ_STRING 9 Test_dll.for

test_main.exe 00401086 TEST_MAIN 13
TEST_MAIN.FOR
test_main.exe 0043F119 Unknown Unknown Unknown
test_main.exe 00428469 Unknown Unknown Unknown
KERNEL32.dll 77E97D08 Unknown Unknown Unknown

When I place the open in a additional subroutine in a secondary DLL,
this progam will work well.

SUBROUTINE OPEN_FILE ( CHANAL )
IMPLICIT NONE
INTEGER CHANAL
OPEN ( CHANAL , FILE = 'TEST.DAT' )
RETURN
END

What ist the reason?

Thanks for help
0 Kudos
6 Replies
Steven_L_Intel1
Employee
524 Views
When you created the console application, one of the project wizard dialog boxes asked if you were going to use this with a Fortran DLL. If you checked the box for that, it would change the project settings so that the console application uses the shared Fortran run-time DLL. If not, then the console application and your DLL have independent copies of the Fortran run-time, and they don't know about each other.

Go into Project..Settings..Libraries in the console app and change the Run-Time Libraries setting to Single-Threaded DLL (or whatever is shown in this option for your DLL.)

Steve
0 Kudos
Intel_C_Intel
Employee
524 Views
when I do that, i got the following error message

dfordll.lib(DFORMAIN.OBJ) : error LNK2001: unresolved external symbol __imp___fpieee_flt
Debug/test_main.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
0 Kudos
Steven_L_Intel1
Employee
524 Views
Do you also have MS Visual Studio installed? If so, download and install Visual Studio Service Pack 5.

Steve
0 Kudos
durisinm
Novice
524 Views
Part of your problem is probably that your TEST_MAIN program is closing KANAL and not the CHANAL variable you used earlier. KANAL is undeclared and uninitialized.

Mike
0 Kudos
Intel_C_Intel
Employee
524 Views
I too have a related problem with switching to the FORTRAN DLL. I am using Fortran 6.1A and just switched the project from using statically linked Fortran Runtimes to DLL runtimes and I get the same linker error with __imp___fpieee_flt.


As suggested, I applied SP5 for Visual Studio (again) but that did not make any difference. The program linked and ran fine before the switch to DLL runtimes.


Any help or suggestions you could provide I would appreciate.


Thanks.

0 Kudos
Steven_L_Intel1
Employee
524 Views
For 6.1A, see this knowledge base article.

Steve
0 Kudos
Reply