I am studying COM so there’re some basic questions puzzling me…
I know that IDL file is used to describe the method definitions (or the so called ‘contract’ between software modules), and the .H header files contains something like a method prototype, which looks similar to what the IDL is meant for. So, why are these two things coexist? Isn’t one enough?
Many thanks.
Interface description language (IDL) is a small language in itself which provides a programming language independent way to describe an interface. Tools generate .h files from your .idl.
If you only had a .h file it would be impossible to tie into it with another programming language. .h files are very specific to C and C++ code only.
Some other differences are that in .h files you can sometimes have implementation as well as declaration, as well as class member variables. Whereas in IDL you are strictly defining an interface.