[CSC 435] Name Munging in C/C++ vs Fortran

Andrew J. Pounds pounds_aj at mercer.edu
Thu Jan 29 08:07:16 EST 2026


Some of you have already figured this out based on one of the handouts 
from class -- but I wanted to make sure you noticed it.   When you call 
walltime and cputime from Fortran there is no trailing underscore.  When 
you call them from C/C++ then the names are walltime_ and cputime_.

Here is an example from my C code...

    /* Function Prototypes */

    double trig( int, int );
    double conrand ( double* );
    void idcheck( int , double*, double* , double* , double* );
    double walltime_();
    double cputime_();

    wall = walltime_();
    cpu = cputime_();

This is due to how the symbols are treated between Fortran and C in the 
compiler.  This will be REALLY important later when you start writing 
your own libraries.

-- 
*/Andrew J. Pounds, Ph.D./*
/Professor of Chemistry and Computer Science/
/Director of the Computational Science Program/
/Mercer University, Macon, GA 31207 (478) 301-5627/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://theochem.mercer.edu/pipermail/csc435/attachments/20260129/54fb3ffc/attachment.htm>


More information about the csc435 mailing list