Patch, Allocate, Mixed-Language Windows Programming

ID: Q78522


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, version 5.1


SUMMARY

This application note corrects the unresolved externals that may occur when linking a mixed-language Windows program using FORTRAN and C. If the FORTRAN code uses the ALLOCATE statement, LINK may generate the following errors:

LINK : error L2029: Unresolved external: _hfree
LINK : error L2029: Unresolved external: _hmalloc
To obtain the application note "PATCH: Allocate in Mixed-Language Windows Programming," call Microsoft Product Support Services.


MORE INFORMATION

The following file is available for download from the Microsoft Download Center. Click the file name below to download the file:

hf0484.exe
For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address
http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center. The following is the text of the application note:

======================================================================
    Microsoft Product Support Services Application Note (Text File)
     HF0484: PATCH: ALLOCATE IN MIXED-LANGUAGE WINDOWS PROGRAMMING
======================================================================
                                                  Revision Date: 11/91
                                                         Disk Included

The following information applies to FORTRAN version 5.1.

 --------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
| ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
| Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
| PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
| accuracy and the use of this Application Note. This Application    |
| Note may be copied and distributed subject to the following        |
| conditions: 1) All text must be copied without modification and    |
| all pages must be included; 2) If software is included, all files  |
| on the disk(s) must be copied without modification [the MS-DOS(R)  |
| utility DISKCOPY is appropriate for this purpose]; 3) All          |
| components of this Application Note must be distributed together;  |
| and 4) This Application Note may not be distributed for profit.    |
|                                                                    |
| Copyright 1991 Microsoft Corporation. All Rights Reserved.         |
| Microsoft, MS-DOS, and the Microsoft logo are registered           |
| trademarks and Windows is a trademark of Microsoft Corporation.    |
 --------------------------------------------------------------------

This application note corrects a problem that occurs when you link a
mixed-language Windows program using FORTRAN and C. If the FORTRAN
code uses the ALLOCATE statement, LINK generates two errors:

   LINK : error L2029:  Unresolved external: _hfree
   LINK : error L2029:  Unresolved external: _hmalloc

The errors are caused by the absence of several routines in the C-
compatible FORTRAN run-time library. To correct this problem, you must
add to the C-compatible FORTRAN run-time library the three object
modules that are included on the enclosed HF0484 disk.

Modifying the C-Compatible FORTRAN Run-Time Library
---------------------------------------------------

To make the correction to the C-compatible FORTRAN run-time library,
copy the following three object modules from the enclosed HF0484 disk
to the directory where your FORTRAN library is located:

   WHALLOC.OBJ
   WHSEG.OBJ
   HMAP.OBJ

Then, enter the following command

   LIB <LIBNAME.LIB> + WHALLOC.OBJ + WHSEG.OBJ + HMAP.OBJ;

where <LIBNAME.LIB> represents the name of the C-compatible FORTRAN
run-time library you want to modify. You can then delete the three
object modules from the library directory. The library manager will
make a backup file named <LIBNAME.BAK>. When the new library has been
tested successfully, you can also delete this backup file. 

Additional query words:

Keywords : kbfile kbsample
Version : :5.1
Platform :
Issue type : kbinfo


Last Reviewed: November 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.