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

LoadLibrary & GetProcAddress functions

strufolino
Beginner
1,692 Views

Hi all,

written this piece of code in order to use a subroutine contained in a DLL file from a Fortran program.

interface

subroutine dll_test(na,array1,nb,array2)

integer :: na,nb

real*4, dimension(na) :: array1

real*4, dimension(nb) :: array2

end subroutine dll_test

end interface

integer p1

pointer (t,dll_test)

!------------------------------------------------------------

integer,parameter :: nat=15

integer,parameter :: nbt=15

real*4,dimension(nat) :: array1t

real*4,dimension(nbt) :: array2t

!------------------------------------------------------------

p1=loadlibrary('dll_name.dll'C)

t=getprocaddress(p1,"subroutine_name"C)

if (t==0) then

print*,'error opening subroutine in DLL'

endif

call dll_test(nat,array1t,nbt,array2t)

My fortran code does not recognize the statements loadlibrary and getprocaddress.

What am I missing?? Of course I cannot load the DLL....

Regards,

Paolo

0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,692 Views
I moved your thread here because it is a Windows question, but from your other threads I wonder if you are trying to use DLLs on Linux. If so, you can't. You would have to rebuild the code as a Linux .so and the methods for using them in a program is different on Linux.
0 Kudos
Reply