Importing System Header Files
While it is often possible to use the #include directive to include header files in your IDL file, it is not recommended. The MIDL compiler will generate stubs for all functions defined in the IDL file being compiled. Usually a header file contains a number of prototypes that you neither need nor want to include in your stub files, and a #include effectively puts all those definitions into your main IDL file. Furthermore, if there are nonremotable types defined in the header file, the IDL file may not compile.
There are two ways to include type definitions from header files in an IDL file:
- Use the import directive to include data types defined in a header file. Unlike the C-language #include directive, the import directive only picks up type and constant definitions and ignores procedure prototypes. This approach will work as long as your main IDL file does not reference any nonremotable types defined in the header file.
- Create a helper IDL file with a dummy interface that includes the header files. Then, use the import directive to include the helper file. In this way, only the typedefs will appear in the compiled stubs. For example:
//in helper.idl:
interface dummy
{
#include "kitchensink.h"
#include "system.h"
}
//in main.idl:
import "helper.idl";
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기