Microsoft KB Archive/78522

= Patch, Allocate, Mixed-Language Windows Programming =

PSS ID Number: 78522

Article Last Modified on 4/22/2003

-

The information in this article applies to:


 * Microsoft FORTRAN Compiler for MS-DOS 5.1

-



This article was previously published under Q78522



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 &quot;PATCH: Allocate in Mixed-Language Windows Programming,&quot; call Microsoft Product Support Services.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

hf0484.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. 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 &quot;AS IS&quot; 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.   |
 * 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  + WHALLOC.OBJ + WHSEG.OBJ + HMAP.OBJ;

where  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 . When the new library has been tested successfully, you can also delete this backup file.

Keywords: kbfile kbinfo kbsample KB78522

Technology: kbAudDeveloper kbFORTRAN510DOS kbFortranSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.