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

using LOADLIBRARY to load a DLL in IVF 9 for EM64T

david-weinberg
Beginner
311 Views
I am converting code that is working properly in IVF 9.0 32-bit to Em64T. I have a call to

PCGSDLLP = LOADLIBRARY( "PCGLSS.DLL"C)

I have PCGSDLLP declared as an int*8 pointer. The problem is I am getting a zero for the return of the function when the file pcglss.dll is present. Am I calling this correctly for em64t? I am using DFWIN complete code is:
C
USE DFWIN
C
IMPLICIT NONE
C
INTEGER*8 I
C
INTEGER*4 ERRORSTATUS
C
CHARACTER DLLBASEFILENAME*8
C
COMMON /STRINGN/ DLLBASEFILENAME
COMMON /PCGLSSP/ PCGSDLLP
C
POINTER (PCGSDLLP, I)
C
ERRORSTATUS = 0
C
DLLBASEFILENAME = 'PCGLSS'
C
PCGSDLLP = LOADLIBRARY( "PCGLSS.DLL"C)
PRINT*,'PCGSDLLP'
PRINT*, PCGSDLLP
PRINT*, PCGSDLLP
IF ( PCGSDLLP .EQ. 0 ) ERRORSTATUS = -1
C
LOADPCGL = ERRORSTATUS
C
RETURN
END
This all works in 32-bit with the only change that the pointer is an int*4.
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
311 Views
PCGSDLLP should be of type INTEGER(HANDLE), not a pointer.

But that is not your essential problem a pointer should work as well. What does GetLastError() return after LoadLibrary fails?
0 Kudos
david-weinberg
Beginner
311 Views
I need to try this and get back to you with the error code. Thanks.
0 Kudos
david-weinberg
Beginner
311 Views
Problem solved. The DLL was not a valid EM64T.
0 Kudos
Reply