Microsoft KB Archive/123668

= PRB: LNK4022 & LNK4006 Warnings When Build PowerStation 32 DLL =

Article ID: 123668

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft FORTRAN PowerStation 32
 * Microsoft FORTRAN PowerStation 32

-



This article was previously published under Q123668



SYMPTOMS
The following errors are generated when building a DLL using a module definition (.DEF) file that does not use the fully decorated name of a function named testing:

warning LNK4022: cannot find unique match for symbol "TESTING"

warning LNK4006: _TESTING already defined in test.obj; second definition ignored

warning LNK4006: _TESTING@4 already defined in test.obj; second definition ignored

LINK : error LNK1141: failure during build of exports file



RESOLUTION
Use the fully decorated name in the EXPORTS section of the DEF file or the LINK command line.



MORE INFORMATION
There may be times when it is desirable not to modify the Fortran source code to add the DLLEXPORT attribute to a function. For example, you might want to maintain a common code base for several computer platforms. In this case, the exports must be identified in the EXPORTS section of a .DEF file or the LINK command line. In either case, if the name specified is not the fully decorated name, the errors described above will be generated by the linker.

Steps to Reproduce Problem
 Use the sample code listed at the end of this article and this definitions file:

library test

EXPORTS TESTING

  Use the following LINK command to generate the error messages:   link test.obj /dll /def:test.def msfrt.lib msvcrt.lib 

NOTE: The second LNK4006 error generated by the linker gives the correct fully decorated name "_TESTING@4". The @4 in the name indicates the number of bytes in the function parameters.

Example Resolution
To successfully link and produce a DLL, include the fully decorated name in the .DEF file:

library test

EXPORTS _TESTING@4

or in the EXPORT LINK option:   link test.obj /dll /export:_TESTING@4 msfrt.lib msvcrt.lib

Sample Code
C Compile options needed: none subroutine testing(i) integer i       i = i*2 end

Additional query words: 1.00 4.00

Keywords: kblangfortran kbcode KB123668

-

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

© Microsoft Corporation. All rights reserved.