[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::fortran

Title:Digital Fortran
Notice:Read notes 1.* for important information
Moderator:QUARK::LIONEL
Created:Thu Jun 01 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1333
Total number of notes:6734

1223.0. "undefined external to MALLOC and FREE in f90 on WNT" by GEMGRP::LIEB () Mon Mar 17 1997 11:05

    I'm trying to get a fortran source that was KAP'd on unix to build
    under Visual Fortran V5.0 on NT. The problem I am having is that KAP
    has seen fit to place calls to malloc and free in the fortran source. 
    Now I know that malloc and free are standard C routines but I get
    undefined external references from the linker when I try to compile and
    link the application.
    
    The malloc and free calls are declared EXTERNAL in the fortran source.
    The machine code listing indicates a bsr ra, j^MALLOC  and similar
    statement for the call to free.  Is the problem that f90 is uppercasing
    the name of the routine and the actual name is in lower case?  It would
    seem this might be the problem as the C programs which call malloc and
    free work just find.  BTW the link command for the fortran build does
    specify libc.lib as a library.
    
    Hopefully this is some stupid thing I am doing and you all can set me
    straight here.
T.RTitleUserPersonal
Name
DateLines
1223.1QUARK::LIONELFree advice is worth every centMon Mar 17 1997 13:015
Well, if you take out the EXTERNAL statements, it should work, as these are
intrinsics to DVF.  That's the easiest solution - other ways are to add
directives specifying the "C" attribute for the routines.

				Steve
1223.2QUARK::LIONELFree advice is worth every centMon Mar 17 1997 13:045
Other way is to add the line:

	!DEC$ ATTRIBUTES C :: MALLOC,FREE

				Steve