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

create fortran dll in visual studio 6.0

fcedotal
Beginner
269 Views
I am trying to make very simple DLL using Fortran 7.019 inside of Visual Studio 6.0.

When I created the project, I made it an empty dll.
My file is named main.for and created dll named main.dll.

function mult1(x, y)
mult1 = x * y
end

It compiles and makes dll 'main.dll' with no errors.
When I try to call from very simple VB app, I get

Run time error '453'
Can't find dll entry point mult1 in c: ewdllmain.dll

I get very similar error if I try to register with regsvr32.


VB 6. app
Private declare Function mult1 Lib "c: ewexemain.dll" Byval x as double, Byval y as double)

Private Sub Form_Load()
Dim x1 as Double
Dim x2 as Double
Dim x3 as Double

x1 = 2.1
x2 = 3.256
x3 = mult1(x1, x2)
End Sub

please advise
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
269 Views
[pre]
function mult1(x, y)
!DEC$ATTRIBUTES DLLEXPORT, ALIAS: "mult1":: mult1
mult1 = x * y
end
!
!VB 6. app
Private declare Function mult1 Lib "c: ewexemain.dll" ByRef x as Single, ByRef y as Single) as Single


Is it better now :-)? If you need doubles, you have to declare mult1, x, and y as DOUBLE PRECISION in Fortran code.

Jugoslav
0 Kudos
Reply