473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
4 3281
"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
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ida | last post by:
Hi, I am trying to build an dll with Microsoft Visual C++ but during the linking phase I get linking errors. Script.obj : error LNK2019: unresolved external symbol __imp__PyString_AsString...
9
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
0
by: Kevin Stedman | last post by:
I am porting some software from Solaris to Windows. I am using the Windows Visual Studio .NET 2003 Visual C++ compiler. For the fortran files I am using Compaq Visual Fortran 6. I have my...
4
by: Brett | last post by:
Hi, I'm having trouble converting an old project to visual studio C++ .net v7.1.3088 I've updated one of the header files to use #include <iostream>, and used the std namspace. After...
3
by: Gustavo L. Fabro | last post by:
Greetings! I'm a newbie in Visual C++ .NET (have programmed in Borland C++ and Builder for long) and I am trying to do a very simple thing, but I'm stuck. I created an (unmanaged) DLL project...
2
by: SM | last post by:
Hello group, we are converting a VB6 application, written by other people, for .NET Framework. Original application depends on a DLL written in standard C. The application communicates with an...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
4
sangeetha jagannathan
by: sangeetha jagannathan | last post by:
hi i am converting a project from vc++ 6.0 to vc++ 7.1(visual c++ .NET 2003), while compiling i bet a lot of linking errors, can u help me fix it the errors that i encountered are Linking......
2
by: =?Utf-8?B?YmFzaA==?= | last post by:
Hello, I am compiling a CPP code using Visual studion .net 2003. I get the following error, despite having windldap.h and wldap32.dll in my include and lib paths. Here is the error. uuid.lib...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.