| 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 | 
    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.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 1223.1 | QUARK::LIONEL | Free advice is worth every cent | Mon Mar 17 1997 13:01 | 5 | |
| 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.2 | QUARK::LIONEL | Free advice is worth every cent | Mon Mar 17 1997 13:04 | 5 | |
| Other way is to add the line: !DEC$ ATTRIBUTES C :: MALLOC,FREE Steve | |||||