Converting VB6.0 external dll function call to Visual C++ .NET

C

Cyde Weys

I'm currently working on converting a simulator program from Visual
Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but
there's still one thing I haven't gotten to and I've never really had
to deal with it before. I'm programming a front-end for what is a
compiled Fortran program. The VB source does the following to call
the Fortran:

'Defines the subroutine.
Declare Sub Cycle_DW Lib "cycdw.dll" Alias "CYCDW" (ByRef ncall As
Long, ByRef tcr As Double, ByRef II As Long, ByRef XX As Double, ByRef
xres As Double, ByVal AA As String, ByVal aaSize As Integer, ByVal
ares As String, ByVal aresSize As Integer, ByVal ltable As String,
ByVal ltableSize As Integer)

'Actually calls the subroutine.
Call Cycle_DW(lCycMode(1), dCritTemp(1), II(1), XX(1), xres(1), AA,
480, ares, 4800, ltable, 37 * 80)

The program is using 1-indexed arrays (hopefully it'll convert over to
using 0-indexed arrays in C++ with no problems), and it's passing a
pointer to the first element of each array. The numbers 480 and 4800
are character lengths; two arrays are being passed to the program
which are huge arrays of characters, with each 80 characters
representing one string (kind of an awkward way to do it, I know, but
that's how the Fortran program does it and I can't change that).

So, how would I go about converting this to C++? Thanks in advance.
 
M

Mike Wahler

Cyde Weys said:
I'm currently working on converting a simulator program from Visual
Basic 6.0 to Visual C++ .NET. I've figured out most of the stuff, but
there's still one thing I haven't gotten to and I've never really had
to deal with it before. I'm programming a front-end for what is a
compiled Fortran program. The VB source does the following to call
the Fortran:

'Defines the subroutine.
Declare Sub Cycle_DW Lib "cycdw.dll" Alias "CYCDW" (ByRef ncall As
Long, ByRef tcr As Double, ByRef II As Long, ByRef XX As Double, ByRef
xres As Double, ByVal AA As String, ByVal aaSize As Integer, ByVal
ares As String, ByVal aresSize As Integer, ByVal ltable As String,
ByVal ltableSize As Integer)

'Actually calls the subroutine.
Call Cycle_DW(lCycMode(1), dCritTemp(1), II(1), XX(1), xres(1), AA,
480, ares, 4800, ltable, 37 * 80)

The program is using 1-indexed arrays (hopefully it'll convert over to
using 0-indexed arrays in C++ with no problems), and it's passing a
pointer to the first element of each array. The numbers 480 and 4800
are character lengths; two arrays are being passed to the program
which are huge arrays of characters, with each 80 characters
representing one string (kind of an awkward way to do it, I know, but
that's how the Fortran program does it and I can't change that).

So, how would I go about converting this to C++? Thanks in advance.

The C++ language does not define an interface to other languages
except to C. You'll need to peruse the documentation for your
C++ implementation to find out how to link to FORTRAN (if it can
do it at all). Also, how this would work also depends upon which
FORTRAN implementation was used to build the function you're calling.

-Mike
 
C

Cyde Weys

The C++ language does not define an interface to other languages
except to C. You'll need to peruse the documentation for your
C++ implementation to find out how to link to FORTRAN (if it can
do it at all). Also, how this would work also depends upon which
FORTRAN implementation was used to build the function you're calling.

Awwww crap. So it's not as easy as it is in VB, is what you're saying.
 
P

Pete C.

Cyde said:
Awwww crap. So it's not as easy as it is in VB, is what you're
saying.

It is, it's just not on-topic here. You'll need to ask in a Win32 group,
such as comp.os.ms-windows.programmer.win32.

- Pete
 
C

Cyde Weys

Cyde Weys wrote:

It is, it's just not on-topic here. You'll need to ask in a Win32 group,
such as comp.os.ms-windows.programmer.win32.

Thanks for the group recommendation, what the other guy just confused me
and didn't help at all :-/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top