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

Calling DLL with Intel Fortran

kellyatredwood
Beginner
405 Views
This should be simple but isn't working. I'm trying to test calling a simple DLL created with Intel Fortran. I can call the dll from VB without a problem. I cannot get the Fortran test to call.

Can someone help on this. The setting etc.

Here is the Fortran code:

program main

!DEC$ ATTRIBUTES DLLIMPORT::dllt
INTEGER myi(2,2)
do 20 i=1,2
do 10 j=1,2
myi(i,j) = i*j
10 continue
20 continue
call dllt(myi)


stop
end

And here is the code that created the dll the dll was complied and linked to form the file Dll3.dll

subroutine dllt[STDCALL,REFERENCE]
+ ( myI)

C Specify that the routine name is to be made available to callers
C of the DLL and external name should not have any prefix or suffix

!DEC$ ATTRIBUTES DLLEXPORT :: dllt

INTEGER myI(2,2)

do 20 i=1,2
do 10 j=1,2
myi(i,j) = 10*myi(i,j)
10 continue
20 continue
return
end
0 Kudos
2 Replies
Steven_L_Intel1
Employee
405 Views
Add this to the main program:

!DEC$ ATTRIBUTES STDCALL,REFERENCE :: dllt

I would also suggest using the same line in your DLL subroutine, removing the [STDCALL,REFERENCE], which is an old Microsoft syntax.
0 Kudos
kellyatredwood
Beginner
406 Views
That worked. Thanks.
0 Kudos
Reply