Microsoft KB Archive/124597

= Using MKTYPLIB /h Option to Output C or C++ Style Header file =

Article ID: 124597

Article Last Modified on 11/17/2003

-

APPLIES TO

 The Type Library Generator (MKTYPLIB.EXE), when used with:  Microsoft Win32 Software Development Kit (SDK) 3.5

 Microsoft Visual C++ 2.0 Professional Edition 

-



This article was previously published under Q124597



SUMMARY
In addition to generating type libraries, MKTYPLIB can output a C or C++ style header file if you use the optional /h option. When you use the /h option, MKTYPLIB creates a header file with the name specified following the /h option. Any existing file of the same name will be overwritten without warning.

MKTYPLIB always uses the "libraryname" from the LIBRARY keyword in the ODL file to create the #ifndef wrappers in the generated header file, regardless of the name specified for the file on the command line.



MORE INFORMATION
Consider this ODL file (MYPROJ.ODL): // example ODL file library MYPROJ {     ...   } If you run MKTYPLIB on this ODL file by using this command line: <![CDATA[ C:\> MKTYPLIB /h odlfile.h myproj.odl the ODLFILE.H generated by MKTYPLIB looks like this: #ifndef _MYPROJ_H_ #define _MYPROJ_H_ ...  #endif This can cause problems when compiling source files if another header file also uses _MYPROJ_H_ in its #ifndef wrappers. Only the first file to use _MYPROJ_H_ will actually be included in the source file.

If you are using the _ _H_ convention for #ifndef wrappers, make sure none of your header files have the same name as your type library. Alternatively, use a different naming convention for the #ifndef wrappers in your header files.

Additional query words: 2.00 3.50

Keywords: KB124597

-

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

© Microsoft Corporation. All rights reserved.