General advice on C++ F77 multi-language compiling and linking 
Author Message
 General advice on C++ F77 multi-language compiling and linking

I would like to learn how to access f77 subroutines, functions, libraries,
objects from within CO++. I've lurked here and the web and that helped a lot
but I am still unsure on how to get started. My immediate questions involve
compiling and linking software, not so much managing the language
differences. This last part I am working through separately using help from
Mixed language programming using CO++ and fortran 77.

I have a Pentium HT with XP Home and MS VC++6 although the need for multi
threading is not a necessity. My goal is to end up with an application based
on Win32API and MFC that links to f77. I'm probably at the intermediate
stage in CO++ and a beginner in Fortran. (I last used Fortran IV (or was it
66?) in college for a very short time on an IBM 360).

From what I've been able to learn so far, I'll need a f77 compiler running
on Windows-Intel as a minimum. I recently installed and ran f77 examples
using GNU Fortran G77 for Win32 so I can see how to compile and link .a and
.o to .f  and make .exe but what do I need to compile and link  f77 to .cpp,
.h and .rc and maybe .dll and .ocx files?

If I generate the .o and/or .a files using f77, can the rest be done from
within VC++6 or do I need another compiler to combine the two languages?

If I need another command line compiler, can I get one that I can use across
the board for both the Fortran and the CO++ parts? Free is good since all
this is for my personal interest to make economic and engineering freeware.

I've come across MinGW + ConText which would seem to do all that I might
need since it appears to include a windows version of g77, gcc and g++ but I
appreciate your input before I get too far downstream.

 Does something like

 g++ -O2 -mpentium foo1.f(or foo1.o) foo2.cpp foo2.h
foo2.rc -lfoo3.o(or -lfoo3.a) -o myapp.exe summarize where I need to be
headed?

Also would also appreciate any web resources that might provide "go-bys" or
tutorials that might help.

Regards Mike




Tue, 25 Nov 2008 22:40:27 GMT  
 General advice on C++ F77 multi-language compiling and linking
I don't know why but my message got posted with CO++ instead of
SEE_plus_plus


Quote:
>I would like to learn how to access f77 subroutines, functions, libraries,
>objects from within CO++. I've lurked here and the web and that helped a
>lot but I am still unsure on how to get started. My immediate questions
>involve compiling and linking software, not so much managing the language
>differences. This last part I am working through separately using help from
>Mixed language programming using CO++ and FORTRAN 77.

> I have a Pentium HT with XP Home and MS VC++6 although the need for multi
> threading is not a necessity. My goal is to end up with an application
> based on Win32API and MFC that links to f77. I'm probably at the
> intermediate stage in CO++ and a beginner in Fortran. (I last used Fortran
> IV (or was it 66?) in college for a very short time on an IBM 360).

> From what I've been able to learn so far, I'll need a f77 compiler running
> on Windows-Intel as a minimum. I recently installed and ran f77 examples
> using GNU Fortran G77 for Win32 so I can see how to compile and link .a
> and .o to .f  and make .exe but what do I need to compile and link  f77 to
> .cpp, .h and .rc and maybe .dll and .ocx files?

> If I generate the .o and/or .a files using f77, can the rest be done from
> within VC++6 or do I need another compiler to combine the two languages?

> If I need another command line compiler, can I get one that I can use
> across the board for both the Fortran and the CO++ parts? Free is good
> since all this is for my personal interest to make economic and
> engineering freeware.

> I've come across MinGW + ConText which would seem to do all that I might
> need since it appears to include a windows version of g77, gcc and g++ but
> I appreciate your input before I get too far downstream.

> Does something like

> g++ -O2 -mpentium foo1.f(or foo1.o) foo2.cpp foo2.h
> foo2.rc -lfoo3.o(or -lfoo3.a) -o myapp.exe summarize where I need to be
> headed?

> Also would also appreciate any web resources that might provide "go-bys"
> or tutorials that might help.

> Regards Mike





Tue, 25 Nov 2008 22:49:57 GMT  
 General advice on C++ F77 multi-language compiling and linking
Quote:

> I don't know why but my message got posted with CO++ instead of
> SEE_plus_plus



>> I would like to learn how to access f77 subroutines, functions, libraries,
>> objects from within CO++. I've lurked here and the web and that helped a
>> lot but I am still unsure on how to get started. My immediate questions
>> involve compiling and linking software, not so much managing the language
>> differences. This last part I am working through separately using help from
>> Mixed language programming using CO++ and FORTRAN 77.

>> I have a Pentium HT with XP Home and MS VC++6 although the need for multi
>> threading is not a necessity. My goal is to end up with an application
>> based on Win32API and MFC that links to f77. I'm probably at the
>> intermediate stage in CO++ and a beginner in Fortran. (I last used Fortran
>> IV (or was it 66?) in college for a very short time on an IBM 360).

>> From what I've been able to learn so far, I'll need a f77 compiler running
>> on Windows-Intel as a minimum. I recently installed and ran f77 examples
>> using GNU Fortran G77 for Win32 so I can see how to compile and link .a
>> and .o to .f  and make .exe but what do I need to compile and link  f77 to
>> .cpp, .h and .rc and maybe .dll and .ocx files?

>> If I generate the .o and/or .a files using f77, can the rest be done from
>> within VC++6 or do I need another compiler to combine the two languages?

MSVC is not a good match for free Fortran compilers.  Of course, you
have commercial alternatives, but MSVC6 has not been supported for
several years, thus not such a good choice there.  MSVS2005 express is
the only cheap way with current support; as you may have noticed, MS
does not permit Fortran to be used with it, except by command line.  So,
a supported GUI for Fortran costs money, particularly on Windows.

Assuming you are investing in the future (at least in terms of your
learning experience), you should consider one of the combinations of g++
and gfortran (at least version 4.1), if you want free compilers. g95
might be preferred over gfortran 4.0 or g77.  You needn't use more f90
than you like.  Even with g77, you are likely to use some f90 features.

gnu make is viable with either MS or gnu style compilers, either MingW
or cygwin, or otherwise, so I think that is a clear recommendation, if
you are making your own choice.



Wed, 26 Nov 2008 00:31:56 GMT  
 General advice on C++ F77 multi-language compiling and linking
Thanks Tim for your helpful reply.

I installed the following MinGW Current Version modules:

gcc-core-3.4.2-20040916-1.tar.gz

gcc-g++-3.4.2-20040916-1.tar.gz

gcc-g77-3.4.2-20040916-1.tar.gz

binutils-2.14.90-info-html.tar.gz

binutils-2.15.91-20040904-1.tar.gz

mingw-runtime-3.9.tar.gz

w32api-3.6.tar.gz

and set an environmental path to MinGW\bin.

I wrote simple foo1.f and foo2.c files and compiled using

g77 -c foo1.f foo1.o file and linked using

gcc -o foo2 foo2.c foo1.o -lm

which made foo2.exe that executed from within a cmd prompt window.

I looked into cygwin a little bit. For the moment that appears to be too
much of a step out for my addled mind to comprehend. Installing a Linux-like
environment for Windows or Linux itself will probably be my next big
adventure. However, not knowing what I'm missing, it's difficult to say that
I should not be going that route now instead of later. Comments?

I haven't as yet installed gnu make. Just getting foo2.exe to work was as
much fun as I could handle in a day.

I've found g95-MinGW.exe on http://ftp.g95.org/ . Here again, haven't done
anything with it yet.

Two follow-ups if you('ll) don't mind.

I did not download the following modules from MinGW:

MSYS Developer Tool Kit

MSYS

TclTk

gdb

make

mingwPORT

mainly because I don't have a feel for what they do and if I will need them.
I've read the readme files, etc. and I'm still confused. Can someone provide
a short description in Newbie English?

Looking ahead, the foo2.exe file I made was executed from within a cmd
prompt window. I suspect there is no way to change that but will all my C++
GUI based applications (dialog, single document and multi document
interfaces) need be launched from within a cmd prompt window as well?


Quote:
> MSVC is not a good match for free Fortran compilers.  Of course, you have
> commercial alternatives, but MSVC6 has not been supported for several
> years, thus not such a good choice there.  MSVS2005 express is the only
> cheap way with current support; as you may have noticed, MS does not
> permit Fortran to be used with it, except by command line.  So, a
> supported GUI for Fortran costs money, particularly on Windows.

> Assuming you are investing in the future (at least in terms of your
> learning experience), you should consider one of the combinations of g++
> and gfortran (at least version 4.1), if you want free compilers. g95 might
> be preferred over gfortran 4.0 or g77.  You needn't use more f90 than you
> like.  Even with g77, you are likely to use some f90 features.

> gnu make is viable with either MS or gnu style compilers, either MingW or
> cygwin, or otherwise, so I think that is a clear recommendation, if you
> are making your own choice.



Wed, 26 Nov 2008 23:34:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Compile, NCAL Link and Full Link v Compile and Full Link

2. Advice for coupling multi-threaded C++ to Tcl/Tk 8.3.2

3. Advice on multi-language support in app?

4. link f77 compiled routines with f95

5. Linking F77 object files and C++ code on UNIX

6. A general question about languages - Rexx, Natural, C++, and Cobol

7. I want to link Fortran static library compiled with pgf90 compiler with C++ in Linux

8. SGI f77 and PC DVF f77 takes forever to compile

9. Compiling/Linking of Lisp with other languages

10. Request advice about C++ and Visual C++ topics

11. linker error (passing a string from F77 to C++ with Visual C++ 6.0 and CVF 6.6)

12. Looking for OS to meet general requirements, need advice

 

 
Powered by phpBB® Forum Software