Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

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

$
0
0

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


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>