CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Fortran 90 faster than C/C++ (https://www.cfd-online.com/Forums/main/10885-fortran-90-faster-than-c-c.html)

andy++ March 4, 2006 00:40

Re: Fortran 90 faster than C/C++
 
This kind of C code can be written only by a Fortran programmer. If you realy want to try and taste programming in C++ take a good programming course in C++.

Andy


Renato. March 4, 2006 05:53

Re: Fortran 90 faster than C/C++
 
Sorry, as I said, C is to much for me... I'll keep programming in Fortran.

andy++ March 4, 2006 13:31

Re: Fortran 90 faster than C/C++
 
Even though I belong to a Fortran generation I have never written any programme in this language. Simply at the time I started my programming experience the only compiler available to me was Algol 60. Yes, yes I am so old and I think if I was able to learn C++ and become an expert everyone else can. The only problem is if you want to do it. If you are in a group of people programming in Fortran under version control you probably do not have any immediate need to switch to another language. But it is only temporary.

Andy


pivello March 6, 2006 07:29

Re: Fortran 90 faster than C/C++
 
Well, we agree in something. I'm santista and I'll never be a flamenguista - even in Tokio!!!!!!!! :)

By the way, I've been working with fortran (77+90) since january. Do you know how to link c++ and fortran executables? I mean, one fortran executable calls a c++ one, or vice-versa?


Renato. March 6, 2006 08:31

Re: Fortran 90 faster than C/C++
 
In order to link mixed-programmed routines you must firstly compile your routines with its respective compilers, after that you can link the compiled files (object files) with the main linker of your program, for example:

I use the Metis library (entirely written in C standard) with my Fortran 90 programs. After compiling Metis I have the libmetis.a file, thus I link this file with my executable program doing:

ifort -o MyProgram *.o libmetis.a

in Compaq Visual Fortran you must insert the libmetis.a file in the link tab, or set the enviroment variables INCLUDE and LIB of the compiler.

It's the easiest way. Some libraries and routines may require to write interfaces between the languages in order to define argument passing rules (but it's not so hard to do).

Cheers

Renato.


pivello March 6, 2006 08:37

Re: Fortran 90 faster than C/C++
 
Thanks, that's what I was looking for.

Steve March 6, 2006 09:21

Re: Fortran 90 faster than C/C++
 
And if you are porting to multiple platforms, bear in mind that you'll have more success if you use the C++ compiler as a front end to the linker. I.e. compile each file with the appropriate compiler, but link the lot together with a C++ compiler command on the objects.

pc March 6, 2006 12:26

a few good quotes
 
This is always a heated debate. Perhaps we can close it off with a few good laughs about the "fun" of programming:

http://www.bellevuelinux.org/q_programming.html


pivello March 6, 2006 13:49

Re: Fortran 90 faster than C/C++
 
I guess this will be the case, since we're going to use the solver written in fortran, and a GUI written in C++. So the GUI would call the solver at some moment, and the final user would just click a button for it.


All times are GMT -4. The time now is 09:23.