www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/07:02:24

Message-ID: <331AB987.2EA1@sprynet.com>
Date: Mon, 03 Mar 1997 06:44:07 -0500
From: Jerry A Green <graphyx AT sprynet DOT com>
Reply-To: graphyx AT sprynet DOT com
Organization: Custom Solutions
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: g77 calling C calling g77

I am looking for calling conventions for calling C routines from FORTRAN
and vice versa.

One puzzling feature that I have run across it that a C function
referenced from FORTRAN must have an underscore postpended to name of
the C function source:

SUBROUTINE FcallC ()
INTEGER ITEMP

ITEMP = Cfunc()

RETURN
END

int cfunc_()
{
...
}

Now, if I have a group of pre-existing C routines, does that mean that I
must edit all of the routines to add the post-pended underscore in order
to call them from FORTRAN?

What about the reverse sequence, calling FORTRAN from C?  Who gets the
underscore?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019