"Cyde Weys" <> wrote in message
news: om...
> 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
|