Solved

Call FORTRAN DLL (passing String)

Posted on 1998-03-23
1
471 Views
Last Modified: 2013-11-08
I can't seem to get a VB app to call a FORTRAN DLL with a String parameter? I've been using the following code in VB:

Declare Sub GETSTRING Lib "d:\VB4\fortint.dll" Alias "_GETSTRING@8" (Myarray As String)

VB actually crashes when this is run, so I have no idea what the problem is. I've also tried the code listed in the FORTRAN Developer Studio (as above, without Alias), but VB says "Can't find insertion point...". I really need some working code on this one, so I hope that someone can help.
0
Comment
Question by:mffej
1 Comment
 
LVL 5

Accepted Solution

by:
dirtdart earned 200 total points
ID: 1459659
When passing strings from VB to another language, you need to use ByVal, so your declaration would look like this:

Declare Sub GETSTRING Lib "d:\vb4\fortint.dll" Alias "_GETSTRING@8" (ByVal MyArray As String)

You should probably also tell VB what type of return to expect by appending As Long, As String, or whatever is appropriate to the end of the declaration.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

867 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

12 Experts available now in Live!

Get 1:1 Help Now