Version
Creating a new component from an Eiffel project
The second tutorial describes creating a COM component from an Eiffel system. The tutorial example String
is almost identical to StringManipulator
of the previous tutorial. In the StringManipulator
example the wizard starts from an IDL file and builds an Eiffel System; in contrast, the String
example takes an Eiffel system and generates an IDL file and the required plumbing code to make the Eiffel project accessible to COM.
Step by step instructions
- Create a new Eiffel project in the directory $ISE_EIFFEL\examples\com\wizard\e2idl\eproject where $ISE_EIFFEL represents the path to the EiffelStudio installation directory.
- Select the ECF file located in the same directory and compile.
- Start the EiffelCOM Wizard
- In Project, in the Current project input field, type in string and press enter.
- In Project Type, choose Add a COM interface to an existing Eiffel project.
- In the field under Path to Eiffel project location enter $ISE_EIFFEL\examples\com\wizard\e2idl\eproject.
- Click the browse button under Path to system's configuration file (*.ecf) and open the file $ISE_EIFFEL\examples\com\wizard\e2idl\eproject\string.ecf.
- In the text field under Target to use, enter: string.
- In the text field under Name of Eiffel facade class, enter:
string_manipulator
. - In the text field under Name of Eiffel facade class cluster, enter:
root_cluster
. - Click Next.
- In Component Type, choose In-process (*.dll).
- In Generation Options, click the browse button and select the directory where the project should be created. Choose $ISE_EIFFEL\examples\com\wizard\e2idl\generated.
- Make sure both Compile C code and Compile Eiffel code are checked.
- Make sure Clean destination folder prior to generation is selected.
- Click Generate.
- Wait until the wizard is done.
First look at the generated code
The generated Eiffel classes include:
-
ISTRING_MANIPULATOR_INTERFACE
: This class represents the only interface exposed by the COM component. -
STRING_MANIPULATOR_PROXY_IMP
: This class implements the coclass, it inherits from the interface and implements its members. -
ECOM_STRING_REGISTRATION
: This class contains the code required to register the component.
You do not need to modify or implement any classes. The wizard produces a ready-to-use component.