KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q66781: Header Files Do Not Contain Prototypes for C_INIT and C_TERM

Article: Q66781
Product(s): See article
Version(s): 5.10 6.00 6.00a
Operating System(s): OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 10-NOV-1990

The standard header files shipped with the Microsoft C compilers do
not contain prototypes for the functions C_INIT() and C_TERM(). These
functions are called only in specific situations when writing DLLs;
therefore, they were specifically left out of the header files.

When writing DLLs with Microsoft C, you can write your own
initialization and termination routines to override the default
initialization and termination. (This procedure is documented on pages
395-397 of the "Advanced Programming Techniques" manual shipped with C
6.00.) To do this, you must make a call in your code to the functions
C_INIT() and C_TERM(), respectively.

Because these functions are not prototyped anywhere, you must include
your own prototypes to guarantee the correct calling conventions for
these functions and to avoid unresolved external errors when linking.
The correct prototypes are as follows:

   void _far _pascal C_INIT( void );
   void _far _pascal C_TERM( void );

Note that _far and _pascal must be specified without the underscore if
you are using C version 5.10.

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.