KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q38868: Illegal Instruction in CodeView

Article: Q38868
Product(s): See article
Version(s): 1.x 2.00 2.10 2.20 | 2.20
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | S_C h_fortran S_PASCAL | mspl13_basic
Last Modified: 6-DEC-1988

Question:

When I compile and link my C program and try to run it under CodeView,
execution stops on the open curly brace of main. The view then goes to
assembly, and the message "Illegal instruction" appears in the dialog
window. Is there something wrong with the startup code?

Response:

This error can be produced when the main module of a program is
compiled for one memory model and is then explicitly linked with a
library for a different model. When the startup code is linked to the
entry point of the program, different size instructions are used for
the different memory models. If the program expects one size and the
linker links in a different size, the startup instructions will be
misinterpreted and result in this error.

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.