Subject: A Linux question

From: Stojakovic Djordje <[email-masked]>
Date: Mon, 27 Sep 1999 12:08:21 +0100

Dear CClers:

I am a chemistry student using a Pentium PC under Red Hat Linux 5.0.
Presently
I have been trying to adapt a fortran source file written for the g77
compiler
so that it could be compiled with the f2c compiler. In doing so I have
encountered only one problem, and it refers to the g77's "loc"
statement, as in
the following program line:

        ifh=(ih-loc(fh(1)))/8+1

When I try to compile the source code with the f2c compiler, I get an
error
message saying "Undefined reference to 'loc_' ".

My question is this: is there a statement in f2c that would be analogous
to
the statement "loc" in g77 ?

I would be very grateful if you could help me with the problem.

Greetings,

Ana Bara
---------------------------
Department of Chemistry
University of Belgrade
Belgrade, Yugoslavia
E-mail: [email-masked]

---

From: Jochen <[email-masked]>
Date: Mon, 27 Sep 1999 18:27:46 +0200

>encountered only one problem, and it refers to the g77's "loc"

Any special reason not to use g77 on your Linux box ?

-- Jochen
        Heinrich-Heine-Universität, Institut für Physikalische Chemie I
        Universitätsstr. 1, Geb. 26.43.02.29, 40225 Düsseldorf, Germany
phone 02118113681 fax 02118115195  --  www-public.rz.uni-duesseldorf.de/~jochen
[email-masked] -- [email-masked] -- [email-masked]

---

From: [email-masked] (Bernd Melchers)
Date: Mon, 27 Sep 1999 18:46:26 +0200 (MEST)

'Stojakovic Djordje wrote:'
> the following program line:

NAME
     LOC - Obtains the address of a variable

SYNOPSIS
     LOC ([I=]i)

IMPLEMENTATION
     UNICOS, UNICOS/mk, IRIX systems

     CF90, MIPSpro 7 Fortran 90, MIPSpro Fortran 77

STANDARDS
     Fortran extension

DESCRIPTION
     LOC returns the address of a variable, constant, or array.  It accepts
     the following arguments:

     i         The variable for which the address is being requested.
         Specify a variable of any data type.
...

it should be possible to write a c program wrapper for this function,
e.g. something like this

int loc_(void *ptr)
{
/* assumes sizeof(int) == sizeof(void*) */
return (int)ptr;
}

Ciao
Bernd

-- 
Bernd Melchers             | [email-masked]
Freie Universitaet Berlin  | "We don't write software, we compose it."
AG Macromolecular Modelling - Prof. Dr. E.W. Knapp
for more information see http://userpage.chemie.fu-berlin.de/~melchers/

---

From: Matt Challacombe <[email-masked]>
Date: Mon, 27 Sep 1999 14:12:21 -0600

> message saying "Undefined reference to 'loc_' ".

It is a simple matter to write your own loc_ (or loc or loc__) function in c:

unsigned int loc_( int* a ){return (unsigned) a ;}

-Matt

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ Matt Challacombe, Ph.D.           http://www.t12.lanl.gov/~mchalla/ +
+ Los Alamos National Laboratory    email: [email-masked]       + 
+ Theoretical Division              vmail:   (505) 698-4112           +
+ Group T-12, Mail Stop B268        phone:   (505) 665-5905           +
+ Los Alamos, New Mexico  87545     fax:     (505) 665-3909           +
+                                                                     +
+ "The secret to mountain biking is pretty simple. The slower you go  +
+  the more likely it is you'll crash." -- Julie Furtado              +
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+