Solved

declaring dll function...

Posted on 1998-06-24
1
293 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
1 Comment
 
LVL 7

Accepted Solution

by:
tward earned 20 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now