The TypeLibrary class is used for creating
type libraries. A type library
defines one or more COM classes.
In the Trumpet COM example, you can see an example of type library being constructed.
A TypeLibrary is created by using the
create function eg.
(create TypeLibrary "c:/temp/trumpet.tlb")
The absolute path of the type library file is supplied -- by convention, these
have a .tlb extension.
The usual place for Carapace type libraries is in the typelibs sub-directory of the standard install directory eg.
(create TypeLibrary (join (list ::InstallDir "/typelibs/trumpet.tlb")))
A TypeLibrary has the following properties:
| property name | property type | description |
|---|---|---|
guid |
String | the identifier for the library |
name |
String | the name for the library -- this is held within the TypeLibrary
and is not the filename (which is supplied on creation)
|
major |
Integer | the major version no. for the library -- this defaults to 1 if not
explicitly supplied
|
minor |
Integer | the minor version no. for the library -- this defaults to 0 if not
explicitly supplied
|
description |
String | a textual description for the library |
script |
String | the name of a Carapace script file which defines the classes mentioned in the type library -- this may simply be a file which loads in a number of other script files |
path |
List | a list of absolute pathnames of directories which are to be
searched in order to load all Carapace scripts pulled in by
the script property
Since COM may start a server in any directory,
for safety this Note that Carapace always has its standard scripts and binaries directory on its path, so there is no need to include these explicitly. |
localServer |
String | the name of an executable file which, when started, offers the
COM objects declared in the type library.
The generic one supplied by Carapace is caracom.exe. To create a custom server which only includes this type library, see Custom COM Servers. |
inprocServer |
String | the name of a dynamic library (DLL) which, when started, offers the
COM objects declared in the type library.
The generic one supplied by Carapace is caracom.dll To create a custom server which only includes this type library, see Custom COM Servers. |
usage |
String | determines whether the COM server which offers this type library
can offer 1 or more of the components simultaneously
Values are: |
| method name | description |
|---|---|
save |
save the type library to disk -- the file name was supplied at type library creation |
addType |
add the named class to the type library -- the class must be defined before it can be added |
register |
register the type library with COM and Carapace, so that it can be used by COM to spawn servers as required. |
saveSave the type library to disk -- the file name was supplied at type library creation.
Arguments: none
Return type: the empty List is returned
addTypeAdd the named class to the type library -- the class must be defined before it can be added.
Arguments:
| className | String |
Return type: List - the empty list
() is returned.
registerRegister the type library with COM and Carapace, so that it can be used by COM to spawn servers as required.
Entries for each interface of each class contained in the type library are
put intot the system registry under HKEY_CLASSES_ROOT. In addition,
entries are inserted into the system registry under the the
software/Carapace/COM section of the HKEY_CURRENT_USER
hive.
Arguments: none
Return type: the empty List is returned
| Contents | Index | Current topic: COM | Related Links: COM helpers, objects, built-in objects |