User`s guide
Capabilities
A-5
Step 1. Code Generation
The first step in the build process generates all source code and other
supporting files needed to create the component.
The compiler first produces
.c and .h files (foo.h, foo.c, bar.h, and bar.c),
representing the C-language translation of the M-code in the original M-files
(
foo.m and bar.m). It also creates the main source file (mycomponent_dll.cpp)
containing the implementation of each exported function of the DLL. The
compiler additionally produces an Interface Description Language (IDL) file
(
mycomponent_idl.idl), containing the specifications for the component’s type
library, interface, and class, with associated GUIDs. (GUID is an acronym for
Globally Unique Identifier, a 128-bit integer guaranteed always to be unique.)
Created next are the C++ class definition and implementation files
(
mycomponent_com.hpp and mycomponent_com.cpp). In addition to these source
files, the compiler generates a DLL exports file (
mycomponent.def), a resource
script (
mycomponent.rc), and a file containing Visual Basic code
(
mycomponent.bas). This file contains VB call wrappers for each class method
in the form of formula functions.
Step 2. Create Interface Definitions
The second step of the build process invokes the IDL compiler on the IDL file
generated in step 1 (
mycomponent_idl.idl), creating the interface header file
(
mycomponent_idl.h), the interface GUID file (mycomponent_idl_i.c), and the
component type library file (
mycomponent_idl.tlb). The interface header file
contains type definitions and function declarations based on the interface
definition in the IDL file. The interface GUID file contains the definitions of the
GUIDs from all interfaces in the IDL file. The component type library file
contains a binary representation of all types and objects exposed by the
component.
Step 3. C++ Compilation
The third step compiles all C/C++ source files generated in steps 1 and 2 into
object code. One additional file containing a set of C++ template classes
(
mclcomclass.h) is included at this point. This file contains template
implementations of all necessary COM base classes, as well as error handling
and registration code. See “Compiler Requirements” on page -x for a list of
supported C++ compilers.