This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getarg_ and iargc_

On Fri, Mar 17, 2006 at 12:49:16AM +0100, Steven Bosscher wrote:
> On 3/17/06, Steve Kargl <> wrote:
> > If
> > you really want to expose getarg_ and iargc_, look at abort_.
> I really do want to somehow make it easy for people to link against
> libgfortran when they are compiling stuff, and not get link errors. 

I've thought about adding an -fall-intrinsics option that
would essentially disable the checking of intrinsics when
-std=f95 is used.  That is,

program a
  i = iarg()
  print *, i
end program a

could be compiled with "gfortran -fall-intrinsics -std=f95".

> That does mean exposing getarg_ and iargc_, however I'd be perfectly
> fine with stuffing those exports in a separate file, for examle
> g77_compat.c or whatever.  That does polute the namespace, I know. 
> But IIUC the problems that this might cause could be avoided by
> exporting these compatibility names as weak symbols.  The GCC manual
> has as an example:
>           void __f () { /* Do something. */; }
>           void f () __attribute__ ((weak, alias ("__f")));
> We could e.g. do.
> extern void getarg_i4 (GFC_INTEGER_4 *, char *, gfc_charlen_type);
> iexport_proto(getarg_i4);
> void getarg_ (GFC_INTEGER_4 *, char*, gfc_charlen_type)
>      __attribute__ ((weak, alias (#IPREFIX(getarg_i4))));
> or something along the line of this (I'm pretty sure the above does
> not actually work ;-)

Unfortunately, you're trying to solve a different problem.  An
application that tries to look into the internals of a runtime
library needs to change if the internals change.  SciLab should
mangle to the gfortran internal names.

AFAIK, weak symbols don't work with static linking.

I would support a separate g77 compat library and a -flibg2c
option.  The option would set up the linking with 
"-lcompat_g2c -lgfortran".  This would allow to keep libgfortran
fairly clean while supplying the garbage.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]