KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Article: Q57939
Product(s): See article
Version(s): 5.10
Operating System(s): OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 8-MAR-1990

Problem:

I have no problem building an /Od version of a DLL. However, I cannot
build an /Ox optimized version. When I attempt to link the DLL, I get
the following error:

   LINK : error L2029: Unresolved externals:

   __CIsin in file(s):
    FOO.OBJ(foo.c)

I am using the alternate math library as detailed in MTDYNA.DOC.

Response:

Your problem is caused by the compiler optimizing with intrinsics
(/Oi). The function you get the unresolved external on is the
intrinsic version of sin(). LLIBCDLL and all the alternate math
libraries do not include ANY intrinsic math functions.

To work around this, you have two options:

1. Compile with /Oalt. The is the easiest because it requires no code
   changes.

2. Add the following line to your code for each function that is not
   in LLIBCDLL and you can use /Ox for maximum possible optimization:

      #pragma function({func1} {func2}...{funcN})

   This tells the compiler to use the standard version instead of the
   intrinsic version of these functions.

For more information on the function pragma, see Page 94 in the
"Microsoft C Optimizing Compiler: User's Guide."

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.