Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Calling function mktime from fortran.

Michael_Menge
Beginner
1,009 Views
We are porting a fortran program from OpenVMS to Suse Linux SLES10 an have installed for testing the Intel Compiler Suite Professional Edition for Linux*. The application uses function qsort and mktime (VMS: decc$qsort and decc$mktime from VMS-CRTL-Library).
Function qsort is part of the intel fortran compatibility library, but the reference to function mktime isn't resolved, I get 'undefined reference to mktime_' when linking.
In which library can I find function mktime? Do I have to install the intel c/c++ compiler too for mktime is probably part of a library of the c compiler? What is to do to get the reference resolved?
0 Kudos
2 Replies
Stephen_D_Intel
Employee
1,009 Views
Hi Michael,

The C-library mktime is defined in libc. To get rid of the trailing underscore, you can try something like this
in your Fortran program:

!dir$ attributes alias: 'mktime' :: mktime

Regards,
Steve D.
Intel Developer Support

0 Kudos
TimP
Honored Contributor III
1,009 Views
gcc counts as an ifort interoperable compiler for USE iso_c_binding, so you ought to be able to call mktime the portable way.
0 Kudos
Reply