Home > Archive > Fortran > May 2005 > Re: static function ? how ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: static function ? how ?
|
|
|
| Hi,
Thanks for all your fast response. So in F77, that's impossible.
Well, I'm thinking another approach ... don't know if it's possible ...
The reason I asked Fortran static function/subroutine is I want to
avoid name space conflict. I'm not a Fortran programmer ... but
want to use some math lib. (from www.netlib.org) written by Fortran in
C.
If I can make public subroutines to static ... then the risk for name
space
conflict can be avoided when I linking multiple Fortran lib together.
For "SUBROUTINE FOO", if we look at the object file (or lib) by
"nm" command, we will see something like:
foo.o:
U foo_
00000000 T foo_
The "T" indicate that foo_ is public accessible function call. If it's
local
or static function .... instead of "T", the indicator will be "t".
So, if "nm" can tell the different between "T" and "t" ... it should be
possible to edit the object file directly by change "T" to "t" ...
I strongly "FEEL" that this might work ... anyone has comment on
this.
Best Regards
KC
kccheng@linuxdaq-labs.org
| |
| Janne Blomqvist 2005-05-26, 3:59 pm |
| In article <1117098670.031977.150050@g44g2000cwa.googlegroups.com>, KC wrote:
> So, if "nm" can tell the different between "T" and "t" ... it should be
> possible to edit the object file directly by change "T" to "t" ...
> I strongly "FEEL" that this might work ... anyone has comment on
> this.
Yeah, it could probably work, in principle at least. You might need to
experiment around with a binary editor. However, I think the Path of
Less Pain [TM], both for you and potential users of your code, is to
just choose names for your C functions that don't conflict with the
library.
--
Janne Blomqvist
| |
| Greg Lindahl 2005-05-26, 9:00 pm |
| In article <1117098670.031977.150050@g44g2000cwa.googlegroups.com>,
KC <kcc1967@gmail.com> wrote:
>So, if "nm" can tell the different between "T" and "t" ... it should be
>possible to edit the object file directly by change "T" to "t" ...
>I strongly "FEEL" that this might work ... anyone has comment on
>this.
Yes, I have a comment: Don't do that, it will hurt you.
-- greg
|
|
|
|
|