CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Compaq Visual Fortran 6.6, DLL and Module

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 2, 2019, 04:41
Default Compaq Visual Fortran 6.6, DLL and Module
  #1
New Member
 
Bakhbergen Bekbauov
Join Date: Jan 2019
Posts: 2
Rep Power: 0
Bakhbergen is on a distinguished road
Dear Fortran Users,

I need to create and use dynamic-link library (DLL) for Fortran application using Compaq Visual Fortran 6.6. The following code works just fine:

###########################################
PROGRAM AMAIN1
IMPLICIT NONE
REAL(8):: A,B,S
A = 1D0
B = 2D0
CALL SUBRO1(A,B,S)
PRINT*, 'S = ', S
END PROGRAM AMAIN1
###########################################
SUBROUTINE SUBRO1(A,B,S)
!DEC$ ATTRIBUTES DLLEXPORT :: SUBRO1
IMPLICIT NONE
REAL(8):: A,B,S
S = A + B
RETURN
END SUBROUTINE SUBRO1
###########################################
The result is correct:
S = 3.00000000000000
Press any key to continue
###########################################

However, if I implement the same algorithm using the module, I get inconsistent result (i.e. zero):

###########################################
PROGRAM AMAIN2
USE MODUL2
IMPLICIT NONE
A = 1D0
B = 2D0
CALL SUBRO2
PRINT*, 'S = ', S
END PROGRAM AMAIN2
###########################################
MODULE MODUL2
IMPLICIT NONE
REAL(8):: A,B,S
END MODULE MODUL2
###########################################
SUBROUTINE SUBRO2
!DEC$ ATTRIBUTES DLLEXPORT :: SUBRO2
USE MODUL2
IMPLICIT NONE
S = A + B
RETURN
END SUBROUTINE SUBRO2
###########################################
The result is incorrect:
S = 0.000000000000000E+000
Press any key to continue
###########################################

As can be seen above, DLL contains only subprogram in both cases (SUBRO1 and SUBRO2, respectively). I have built DLL and LIB files from the visual development environment. The second case (with the use of module) represents the structure of my large source-code so I need to resolve this issue. Any advice would be greatly appreciated.
Bakhbergen is offline   Reply With Quote

Reply

Tags
compaq visual fortran 6.6, dll, module


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CFX11.0 cannot find dll in User Fortran brunoc CFX 0 April 4, 2007 11:42


All times are GMT -4. The time now is 16:28.