Solved

declaring dll function...

Posted on 1998-06-24
1
296 Views
Last Modified: 2013-11-08
I have dll(in fortran) function with an multidimension array argument type. How can i declare this funtion in my VB code?


Thanx
Mário Guedes
0
Comment
Question by:mguedes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
tward earned 20 total points
ID: 1464201
I believe this would work for Fortran, although only testing with a C DLL:

#If Win32 Then

    Private Declare Function ProcessArray Lib "vb4dll32.dll"(a() As _
        String) As Variant
    Private Declare Function CopyArray Lib "vb4dll32.dll" (a() As _
        String) As Variant

#Else

    Private Declare Function ProcessArray Lib "vb4dll16.dll"(a() As _
        String) As Variant
    Private Declare Function CopyArray Lib "vb4dll16.dll" (a() As _
        String) As Variant

#End If


Private Sub ArrayTest()

    Dim a(4, 5, 6) As String
    Dim v1 As Variant

    a(0, 1, 2) = "Hello!"

    Print VarType(v1)
    v1 = ProcessArray(a())
    Print VarType(v1)

    MsgBox v1(0, 1, 2), vbInformation, "Element Value of Array _
           Returned In Variant - 1"
    MsgBox a(0, 1, 2), vbInformation, "Modified Element Value of _
           Passed-in Array - 1"

    v2 = CopyArray(a())
    Print VarType(v2)

    MsgBox v2(0, 1, 2), vbInformation, "Element Value of Array _
           Returned In Variant - 2"
    MsgBox a(0, 1, 2), vbInformation, "Modified Element Value of _
           Passed-in Array - 2 "

End Sub

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question