?
Solved

declaring dll function...

Posted on 1998-06-24
1
Medium Priority
?
299 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 40 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

752 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