Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

can't get value correctly from fortran dll to VB.net back

Hi Everyone,

I can't make the following code working in VS2015 with IVF, though it is very simple. Value C from dll is always 0, not 6.0 as expected. Thanks so much.

//my VB code:

Public Class Form1
    Public Declare Sub DLL_ROUT Lib "D:\Debug\Dll2.dll" _
    (ByVal A As Double, ByVal B As Double, ByVal C As Double)
    Public Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim A As Double
        Dim B As Double
        Dim C As Double
        A = 2.0
        B = 3.0
        Call DLL_ROUT(A, B, C)
        Button1.Text = C
    End Sub
End Class

 

// my Fortran  dll code:

SUBROUTINE DLL_ROUT (A, B, C)
IMPLICIT NONE
! Specify that DLL_ROUT is exported to a DLL
! and that the external name is 'DLL_ROUT'
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: DLL_ROUT
!DEC$ ATTRIBUTES ALIAS:'DLL_ROUT' :: DLL_ROUT

DOUBLE PRECISION A, B, C

C = A * B
RETURN
END

 

 

 

0 Kudos
2 Replies
Highlighted
Valued Contributor I
13 Views

This looks more like a problem for the Windows Forum, and not for the Linux/MACOSX Forum.

 

0 Kudos
Highlighted
Beginner
13 Views

sorry, wrong forum

0 Kudos