Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Call FORTRAN DLL (passing String)

Posted on 1998-03-23
1
Medium Priority
?
476 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
[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 5

Accepted Solution

by:
dirtdart earned 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
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.
This video teaches viewers about errors in exception handling.
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…

721 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