problems using fortran dll to vb 
Author Message
 problems using fortran dll to vb

i use ms fortran power station 4.0
and made dlls like bellow

//////////////////////////////////
    stop
    end

      subroutine fordll(a,b)

   !MS$ATTRIBUTES DLLEXPORT,ALIAS:'fordll' :: fordll
   !MS$ATTRIBUTES REFERENCE :: a
   !MS$ATTRIBUTES REFERENCE :: b

   double precision a(1:2),b(1:2)

      do 10 i=1,2
      b(i)=a(i)
10    continue
   end
/////////////////////////////////////
and the code in vb5.0 is that

//////////////////////////////////////
Public Declare Sub fordll Lib ".\fordll.dll" (ByRef a() As Double, ByRef
b() As Double)

Private Sub Command1_Click()
Dim a(1 To 2), b(1 To 2) As Double
a(1) = 1
a(2) = 2
Call fordll(a, b)
MsgBox (b(1))
MsgBox (b(2))

End Sub
/////////////////////////////////////////

when the program run. some error occurs..

"type mismach: array or user defined type expected"

will you help me this problems........



Wed, 18 Jun 1902 08:00:00 GMT  
 problems using fortran dll to vb
jhlee,

Change the Visual Basic code to this:

Declare Sub fordll Lib "fortdll.dll" (ByRef a As Double, ByRef b As Double)

Private Sub Command1_Click()
Dim a(1 To 2) As Double, b(1 To 2) As Double
a(1) = 1
a(2) = 2
Call fordll(a(1), b(1))
MsgBox (b(1))
MsgBox (b(2))
End Sub

The problem is that visual basic works with safe-arrays, which are different
to fortran arrays, so you cannot pass the arrays to Fortran the way you were
trying to do, pass instead the first element of the array.

Marco A. Garcia
Canaima Software
3981 Utah St.
San Diego, CA 92104
U.S.A.

http://www.canaimasoft.com
Developers of f90SQL and f90ADO,
the Complete Database Connectivity Solution for Fortran

Quote:

>i use ms fortran power station 4.0
>and made dlls like bellow

>//////////////////////////////////
>    stop
>    end

>      subroutine fordll(a,b)

>   !MS$ATTRIBUTES DLLEXPORT,ALIAS:'fordll' :: fordll
>   !MS$ATTRIBUTES REFERENCE :: a
>   !MS$ATTRIBUTES REFERENCE :: b

>   double precision a(1:2),b(1:2)

>      do 10 i=1,2
>      b(i)=a(i)
>10    continue
>   end
>/////////////////////////////////////
>and the code in vb5.0 is that

>//////////////////////////////////////
>Public Declare Sub fordll Lib ".\fordll.dll" (ByRef a() As Double, ByRef
>b() As Double)

>Private Sub Command1_Click()
>Dim a(1 To 2), b(1 To 2) As Double
>a(1) = 1
>a(2) = 2
>Call fordll(a, b)
>MsgBox (b(1))
>MsgBox (b(2))

>End Sub
>/////////////////////////////////////////

>when the program run. some error occurs..

>"type mismach: array or user defined type expected"

>will you help me this problems........



Wed, 18 Jun 1902 08:00:00 GMT  
 problems using fortran dll to vb
jhlee,

Change the visual basic code to this:

Declare Sub fordll Lib "fortdll.dll" (ByRef a As Double, ByRef b As Double)

Private Sub Command1_Click()
Dim a(1 To 2) As Double, b(1 To 2) As Double
a(1) = 1
a(2) = 2
Call fordll(a(1), b(1))
MsgBox (b(1))
MsgBox (b(2))
End Sub

The problem is that visual basic works with safe-arrays, which are different
to fortran arrays, so you cannot pass the arrays to Fortran the way you were
trying to do, pass instead the first element of the array.

Marco A. Garcia
Canaima Software
3981 Utah St.
San Diego, CA 92104
U.S.A.

http://www.canaimasoft.com
Developers of f90SQL and f90ADO,
the Complete Database Connectivity Solution for Fortran

Quote:

>i use ms fortran power station 4.0
>and made dlls like bellow

>//////////////////////////////////
>    stop
>    end

>      subroutine fordll(a,b)

>   !MS$ATTRIBUTES DLLEXPORT,ALIAS:'fordll' :: fordll
>   !MS$ATTRIBUTES REFERENCE :: a
>   !MS$ATTRIBUTES REFERENCE :: b

>   double precision a(1:2),b(1:2)

>      do 10 i=1,2
>      b(i)=a(i)
>10    continue
>   end
>/////////////////////////////////////
>and the code in vb5.0 is that

>//////////////////////////////////////
>Public Declare Sub fordll Lib ".\fordll.dll" (ByRef a() As Double, ByRef
>b() As Double)

>Private Sub Command1_Click()
>Dim a(1 To 2), b(1 To 2) As Double
>a(1) = 1
>a(2) = 2
>Call fordll(a, b)
>MsgBox (b(1))
>MsgBox (b(2))

>End Sub
>/////////////////////////////////////////

>when the program run. some error occurs..

>"type mismach: array or user defined type expected"

>will you help me this problems........



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Call DLL created using Fortran from VB

2. Problem mixing ASM dll using FPU with VB

3. Problem mixing ASM dll using FPU with VB

4. Problem using DVF to Build DLL for VB

5. Problems with Fortran dll run within VB.

6. MS Fortran DLL called from MS VB 6.0 problem

7. VB or C++ to Fortran DLL's, stack problems

8. Using a Fortran DLL inside another Fortran DLL

9. problem with using dll in fortran

10. Using a VB DLL

11. Using VB-Created DLLs

12. Using VB Active X DLLs in Clarion

 

 
Powered by phpBB® Forum Software