Solved

Call FORTRAN DLL (passing String)

Posted on 1998-03-23
1
472 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 78
Visual Studio 2005 text editor 10 38
rhino JavaScript import, load 25 82
Export Data to Different .csv Files 26 104
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

776 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