Compiling C programs w/ FORTRAN nag libraries

Compiling C programs w/ FORTRAN nag libraries

Post by Rick Power C-3028 x-88 » Wed, 13 Apr 1994 00:20:40



        I don't know if these are the right places for this post -but
alas I need some help:

I am working on an SGI crimson running IRIX 4.0.5 and we recently
got the FORTRAN NAG libraries. Previous to this I had written
programs in C -- I was wondering if it is possible to combine
my programs with these libraries so that I do not have to write
routines that have been canned already?

        This is an interesting problem to more people than I.
I would appreciate any advice that people could give. :-)

BTW:    we have both f77 and MIPS cc compiler's on this machine
        I do not know if this matters.

                                        Thanks in advance,
                                        Rick.

--
I claim not to have controlled   ---------  Richard Power ----------
events, but confess plainly      -------  Physics Department -------
that events have controlled me.  Memorial University of Newfoundland

 
 
 

Compiling C programs w/ FORTRAN nag libraries

Post by Raja B Dao » Wed, 13 Apr 1994 12:49:43



>-- I was wondering if it is possible to combine
>my programs with these libraries so that I do not have to write
>routines that have been canned already?

Note: The following works on SUN, DEC AXP, and SGI.  For RS6K remove the '_'.
      I think it won't work on CRAY.

Calling SUBROUTINE FOO(IVAR, RVAR) from C use foo_(&ivar, &fvar);

[i.e. lower case function name, followed by '_', and all variables
passed by reference]

Datatypes mapping: INTEGER -> int; REAL -> float; DOUBLE PRECISION -> double;

If I remember correctly, character arrays require the array length to
be passed at the end of the argument list.  I don't have my manuals
at home, so I'll let somebody else answer this one (or email me and
I'll look it up at work).

--Raja

Raja Daoud                                      Ohio Supercomputer Center
Trollius Operating System                       1224 Kinnear Road


 
 
 

Compiling C programs w/ FORTRAN nag libraries

Post by Chuck Campbe » Thu, 14 Apr 1994 09:00:38



>    I don't know if these are the right places for this post -but
> alas I need some help:
> I am working on an SGI crimson running IRIX 4.0.5 and we recently
> got the FORTRAN NAG libraries. Previous to this I had written
> programs in C -- I was wondering if it is possible to combine
> my programs with these libraries so that I do not have to write
> routines that have been canned already?
>    This is an interesting problem to more people than I.
> I would appreciate any advice that people could give. :-)
> BTW:       we have both f77 and MIPS cc compiler's on this machine
>    I do not know if this matters.
>                                    Thanks in advance,
>                                    Rick.
> --
> I claim not to have controlled   ---------  Richard Power ----------
> events, but confess plainly      -------  Physics Department -------
> that events have controlled me.  Memorial University of Newfoundland


Rick,
O'Reilly & assoc publish a book called unix for fortran programmers which
covers exactly this subject in good detail.  They explain about argument
passing, array major and minor order differences between languages,
general compiler behavior (such as fortran pre or post pending underscores
to routine names at compile time) and more.

Yes you can do what you ask, grab the book and find out how easy it really is.

-chuck

 
 
 

1. Fortran NAG libraries

Hello,

Does the Redhat distribution's Fortran compiler come with the NAG libraries
and if so, how does one access them.  If not, where should I look to obtain
a copy of them.  Thanks.

Ted To

--
--

Department of Economics                         +44 1334 462435
University of St. Andrews                       +44 1334 462444 (fax)
St. Andrews, Fife KY16 9AL
Scotland

2. Some basic questions on Dec Alphas.

3. COMMERCIAL: NAG Fortran Library, Mark 16, available on Linux

4. JetDirect: 1 printer stops, all printers stop!

5. Experience with NAG Fortran Compiler ?

6. Robotics modem

7. NAG Fortran compiler for Linux?

8. LILO prints just LI

9. COMMERCIAL: NAG Fortran 90 compiler available on Linux

10. NAG Fortran 90 ? Where ?

11. nag.ps or nag.pdf?

12. How can I compile the program( call Fortran(lf95) from C(gcc) ) on Linux?thanks

13. Memory problem for executing a fortran compiled program (aix 432)