Re: include file for a COM client (consumer)
George wrote:
Hello everyone,
When writing an ATL COM server, MIDL compiler will automatically
generated file _i.c and _i.h from IDL definition.
My question is whether my below usage for the two files are correct
when writing a COM client (consumer)?
1. I put _i.h file into the "Header files" of the client project, and
using it to make the build for client project;
2. I put the _i.c into the "Source files" of the client project, and
using it to make the build for client project.
You could do that, but it's not really the intended solution. The only
output from your COM "server" project should be:
- Executable(s) - EXE and/od DLL file(s)
- Interface descriptions - IDL and/or TLB files, but sometimes people do
publish a .h file instead.
If you decide to publish your interfaces as IDL, then for your client
project you should compile the IDL using mdil to produce a header file that
your client can include.
If you decide to publish your interfaces as a type library, then your client
should #import the type library to generate C/C++ declarations that match
your types/interfaces.
-cd