Stubs and application code are packaged into multiple DLLs, but
DLLs contain the stubs for more than one IDL file.
This situation is handled by `annotating' the IDL files to
indicate which DLLs they will be compiled into. The annotation
takes the form of some #ifdefs to be inserted in the
stub headers. For example,
// one.idl
#pragma hh #ifndef COMPILING_FIRST_DLL
#pragma hh # ifndef USE_stub_in_nt_dll
#pragma hh # define USE_stub_in_nt_dll
#pragma hh # endif
#pragma hh #endif
#include <two.idl>
module ModuleOne {
...
};
// two.idl
#pragma hh #ifndef COMPILING_SECOND_DLL
#pragma hh # ifndef USE_stub_in_nt_dll
#pragma hh # define USE_stub_in_nt_dll
#pragma hh # endif
#pragma hh #endif
#include <three.idl>
...
Here, one.idl is packaged into first.dll and
two.idl is in second.dll. When compiling
first.dll, the COMPILING_FIRST_DLL define is
set, meaning definitions from one.idl (and any other
files in that DLL) are not imported. Any other module that
includes the stub header for one.idl does not define
COMPILING_FIRST_DLL, and thus imports the necessary
symbols from the DLL.
Rather than explicitly listing all the pre-processor code, it
can be cleaner to use a C++ header file for each DLL. See the
COS services IDL files in idl/COS for an example.