From: Jari Oksanen Newsgroups: comp.os.msdos.djgpp Subject: Re: fortran with DJGPP Date: Wed, 27 May 1998 14:10:48 +0100 Organization: Univ Helsinki Lines: 56 Message-ID: <356C10D8.3BD1@helsinki.fi> References: Reply-To: jari DOT oksanen AT helsinki DOT fi NNTP-Posting-Host: neopc161.lpt.fi Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Federico Spinazzi wrote: > Hy all, > Hi Federico and other readers, Our news server was slightly autistic last week: I could read news but the messages I sent were not distributed outside our own system. This may mean that this post does not come to the newsgroup. This in turn means that this message will probably appear here after long, long time. So my apologies if this message crops out sometimes in autumn and looks completely outdated and irrelevant. > I would like to ask you which is the best method to use fortran with > djgpp: > - f2c + gcc ? > or > - g77 + gcc ? > or > - it is possible to link fortran code to c/c++ code (this question > probably reveals the fact that I don't know the way g77 works) ? > I have used both. Recently, I prefer f2c->gcc. The main reason to this is that the djgpp version of g77 seems to be slightly broken: the programs run normally, but crash *after* executing the stop statement. These crashes feel uncomfortable, although it may be that everything before STOP was done OK. (Personal note to F.Spinazzi: one of these crashing programs was CANOCO). Some things you must beware: For g77, you have to change your gcc. I don't know how this goes with the new gcc 2.8.x. That is one reason why I haven't yet upgraded my gcc. f2c and g77 have *unidentical* libraries with the same name (libf2c.a). The reason for this is that g77 started with f2c libraries. Since then the g77 library started her independent life, but kept her old name. This may be a nuisance if you have both in your pc. The problems I had with g77 after-stop-crashes were probably problems in g77-libf2c.a, since they did not appear with f2c-libf2c.a. However, I was then informed by real gurus that it is not safe to mix these two f2c-libraries. Linking ForTran and C/C++ is *easiest* with f2c. You can maintain and edit Fortran files, and you need only one extra -- and short, timewise -- step during compilation. It is easiest for two reasons: Original Fortran is easier to read than f2c-ed C/C++, and you can see with your own eyes how you have to call your subroutines in C/C++. Real gurus know that off-hand and they may link object files directly. We mortals may be happy with the helping hand of f2c. I guess that you're going to do matrix algebra. There you should remember that Fortran sees your dynamic C-matrices as transposed. This can be a real pain if you try to plug in Fortran subroutines, but often it is enough that you remember this feature. -- Jari Oksanen -- Lahtis, Finland / Luokta, Suopma / Lahti, Häme.