Docsity

Step-by-Step: Creating an ATL Out-of-Process Server with Active Temple Library - Prof. Jam, Study Guides, Projects, Research of Engineering

Toggle sidebar
bg1
ATLexe Example
This example builds an out-of-proc (exe) multi-threaded server that
implements the ISum interface. Its purpose is to show how to build
components with the Active Temple Library (ATL). The files generated
are:
1. ATLexe.idl โ€“ IDL file created by the ATL Object wizard from
developer inputs. The IDL describes the ISum interface and class
object.
๏‚ทmanual page tells you how to create this example using ATL and
its wizards.
2. ATLclient.cpp โ€“ created entirely by the developer. It imports the
type library, generated by midl from its IDL file. The type library
import brings in header files which:
๏‚ทdeclare the component and interface IDs
๏‚ทdeclare smart pointers and wrapper functions for the inteface.
The wrapper functions simply call your interface methods and
throw exceptions if any errors occur.
๏‚ทdeclare an error class, _com_error. The exceptions throw objects
of this class and you can extract strings describing the error from
them (see client code).
3. Sum.h โ€“ created by ATL Object wizard, provides a class declaration
for the component (actually, the real component is derived from this
class to add implementations for the class factory and component
IUnknown interface.
4. Sum.cpp โ€“ created by ATL and modified by the developer to provide
semantics for the interface implementation.
5. ATLexe.cpp โ€“ generated by the ATL Application Wizard. Provides
the server dll export functions.
6. stdafx.h and stdafx.cpp โ€“ declarations and includes for ATL imple-
mentation code.
7. ATLexe.rc โ€“ resource file for project
8. ATLexe.rgs โ€“ registry script for class object
9. Sum.rgs โ€“ registry script for ISum interface
10. resource.h โ€“ defines some internally used identifiers
When the midl compiler is run it will generate the additional files:
1. ATLexe.h โ€“ interface declarations for component, proxy, and stub.
2. ATLexe.tlb โ€“ type library file
3. ATLexe_i.c โ€“ define GUIDS
4. ATLexe_p.c โ€“ proxy/stub code
Note that a proxy is needed for this demo so these files are included in
the projects.

Partial preview of the text

Download Step-by-Step: Creating an ATL Out-of-Process Server with Active Temple Library - Prof. Jam and more Study Guides, Projects, Research Engineering in PDF only on Docsity!

ATLexe Example

This example builds an out-of-proc (exe) multi-threaded server that implements the ISum interface. Its purpose is to show how to build components with the Active Temple Library (ATL). The files generated are:

  1. ATLexe.idl โ€“ IDL file created by the ATL Object wizard from developer inputs. The IDL describes the ISum interface and class object. ๏‚ท manual page tells you how to create this example using ATL and its wizards.
  2. ATLclient.cpp โ€“ created entirely by the developer. It imports the type library, generated by midl from its IDL file. The type library import brings in header files which: ๏‚ท declare the component and interface IDs ๏‚ท declare smart pointers and wrapper functions for the inteface. The wrapper functions simply call your interface methods and throw exceptions if any errors occur. ๏‚ท declare an error class, _com_error. The exceptions throw objects of this class and you can extract strings describing the error from them (see client code).
  3. Sum.h โ€“ created by ATL Object wizard, provides a class declaration for the component (actually, the real component is derived from this class to add implementations for the class factory and component IUnknown interface.
  4. Sum.cpp โ€“ created by ATL and modified by the developer to provide semantics for the interface implementation.
  5. ATLexe.cpp โ€“ generated by the ATL Application Wizard. Provides the server dll export functions.
  6. stdafx.h and stdafx.cpp โ€“ declarations and includes for ATL imple- mentation code.
  7. ATLexe.rc โ€“ resource file for project
  8. ATLexe.rgs โ€“ registry script for class object
  9. Sum.rgs โ€“ registry script for ISum interface
  10. resource.h โ€“ defines some internally used identifiers When the midl compiler is run it will generate the additional files:
  11. ATLexe.h โ€“ interface declarations for component, proxy, and stub.
  12. ATLexe.tlb โ€“ type library file
  13. ATLexe_i.c โ€“ define GUIDS
  14. ATLexe_p.c โ€“ proxy/stub code Note that a proxy is needed for this demo so these files are included in the projects.