KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q61558: Unresolved External __CImin Caused by /Gh /Os Compile Options

Article: Q61558
Product(s): See article
Version(s): 6.00   | 6.00
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | buglist6.00 buglist6.00a | mspl13_c
Last Modified: 19-JAN-1991

If you use the min() macro to compare two floating-point numbers and
compile with /Gh (generate old helper function names) and /Os
(optimize for size), the function name "__CImin" is generated by the
compiler. Unfortunately, there is no function by this name in any of
the C version 5.10 or 6.00 libraries.

Code Example
------------

// Compile with /Gh /Os

#include <stdio.h>
#include <stdlib.h>

#define TESTVAL 5.0

void main (int argc, char ** argv)
{
   double dValue;

   if (argc > 1)
   {
      dValue = atof (argv[1]);
      printf ("The lesser of %f and %f is %f\n",
              dValue,
              TESTVAL,
              min (dValue, TESTVAL));
   }
   exit (0);
}

As a workaround, compile without /Os optimization.

Microsoft has confirmed this to be a problem with C versions 6.00 and
6.00a. We are researching this problem and will post new information
here as it becomes available.

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.