By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,274 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Jul 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Cyde Weys" <cy**@umd.edu> wrote in message
news:2a**************************@posting.google.c 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

Jul 22 '05 #2

P: n/a
"Mike Wahler" <mk******@mkwahler.net> wrote in news:MuFGc.7306$oD3.1925
@newsread1.news.pas.earthlink.net:
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.

--
~ Cyde Weys ~
Burn the land and boil the sea, you can't take the sky from me ...
Jul 22 '05 #3

P: n/a
Cyde Weys wrote:
"Mike Wahler" <mk******@mkwahler.net> wrote in
news:MuFGc.7306$oD3.1925 @newsread1.news.pas.earthlink.net:
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.


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
Jul 22 '05 #4

P: n/a
"Pete C." <x@x.x> wrote in news:5SIGc.7072$R36.4954
@newsread2.news.pas.earthlink.net:
Cyde Weys wrote:

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.


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

--
~ Cyde Weys ~
Burn the land and boil the sea, you can't take the sky from me ...
Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.