From: danpop@cernapo.cern.ch (Dan Pop)
Subject: Re: fortran + c application linker bug???
Date: Wed, 10 Aug 1994 14:49:35 GMT [thread overview]
Message-ID: <CuBqIn.EE7@news.cern.ch> (raw)
In-Reply-To: muzic.776365235@ds2.uh.cwru.edu
In <muzic.776365235@ds2.uh.cwru.edu> muzic@ds2.uh.cwru.edu (Ray Muzic) writes:
>I am customizing a public domain code which is mainly fortran (program +
>approx 300 subroutines and functions) but has a collection of c routines
>that do plotting via xwindows. The fortran code defines a function screen
>and the c code defines an int screen. When I build this application I get
>an access violation when the c routine tries to assign the value zero to
>screen. This makes sense because according to the debugger,
>screen is considered top be a function. Moreover, when I changed the
>name screen to rscreen in the c code, the program works fine.
>
>My questions are these:
>1) Is this a bug? Should c and fortan keep their own copies of screen?
Yes, this is a bug. Nobody guarantees separate copies of screen.
>1) Why does this program work correctly on other (Unix) platforms? Is it
> because some platforms append underscores, capitalize, or otherwise
> modify variable names of fortran variables?
On many Unix platforms, the Fortran screen becomes _screen_ after
compilation and the C screen becomes _screen. No conflict. In Unix,
any program ends up being linked with the C library. But the Fortran
library contains some functions with the same name as functions from
C library. This trick solves the problem. The preceding underscore is
added to avoid conflicts between the user symbols and the symbols used
internally by the C library.
>2) Is there a way to link things differently to solve this problem for VMS?
I don't think so.
Dan
--
Dan Pop
CERN, CN Division
Email: danpop@cernapo.cern.ch
Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
prev parent reply other threads:[~1994-08-10 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-08-08 17:00 fortran + c application linker bug??? Ray Muzic
1994-08-10 14:49 ` Dan Pop [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox