This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [F03] EXTENDS_TYPE_OF, CLASS IS and libgfortran
On Tue, Nov 03, 2009 at 08:52:01PM +0100, Thomas Koenig wrote:
> On Mon, 2009-11-02 at 23:45 +0100, Janus Weil wrote:
> > However, since my experience with libgfortran is practically zero, I
> > will need some help with this. What I would do is probably to add a
> > new file 'extends_type_of.c' to libgfortran/intrinsics/, whose content
> > could look something like this:
>
> [...]
>
>
> > Now, first technical question: How do I correctly tell the libgfortran
> > Makefile to pick up this file, and add the function to the library?
>
> You add the file to Makefile.am, probably to the gfor_helper_src
> variable. Then you build everything.
>
> This regenerates Makefile.in by running autoconf automatically. Make
> sure (beforehand :-) that you have the correct version of autoconf, and
> make sure to check Makefile.in against the SVN version to catch any
> unpleasant surprises that may suddenly raise their ugly head.
>
> Declare your function if you want it to be callable from the front end,
> and use the export_proto macro on the declaration. You can do that in
> the file itself, unless you want to call it from somewhere else; then it
> should go into libgfortran.h (and you should use iexport_proto).
>
> Add your new global symbol to gfortran.map.
>
This is only the library side of the chnages.
If these are truly intrinsic procedures, you may need to add
code to intrinsic.c, check.c, simplify.c, iresolve.c, trans-intrinsic.c
and gfortran.h.
gfortran.h --> see gfc_isym_id.
intrinsic.c --> add intrinsic procedure to the list of intrinsics with
the right standard.
check.c --> check that the arguments are valid.
simplify.c --> if the arguments are constants, then simplify the expression.
iresolve.c --> resolves the called procedure to the right library routine.
trans-intrinsic.c --> use the gfc_isym_id to determine the translation.
Note, if the procedures can be in-lined, you do it
here.
--
Steve