 |
|
 |
|
Tools for Typelibs - xpt_dump & xpt_link
by Chris Cooper
<coop@netscape.com>
Now that XPIDL is capable of
generating binary type library files (typelibs, or .xpt files)
from IDL code, there is a serious need for tools to manipulate
these files. Currently, there are two such tools,
xpt_dump,
which dumps the contents of a typelib to the screen, and
xpt_link,
which links multiple typelib files together into
ONE BIG TYPELIB. Both tools reside in the
mozilla/xpcom/typelib/xpt/tools/ directory.
Get there quick:
xpt_dump - the typelib dumper
xpt_dump is a tool for reading binary-format typelib files and
dumping their contents to the screen.
Source Code:
mozilla/xpcom/typelib/xpt/tools/xpt_dump.c
Dependencies:
xpt_dump requires both
nspr
(NetScape's Portable Runtime, headers only) and
libxpt
(library of functions for handling type library files).
Command Syntax:
Usage: xpt_dump [-v] filename.xpt
-v verbose mode
As is visible above, xpt_dump takes one argument, filename.xpt,
which must be a valid typelib file. xpt_dump can also take one
option flag, -v for verbose mode (which is disabled by
default). Sample output for both verbose and non-verbose modes
are shown below.
Sample Output:
|
Command Line: (normal)
|
[coop@ivory idl]$ xpt_dump nsISupports.xpt
|
|
Output: (normal)
|
Header:
Major version: 1
Minor version: 0
Number of interfaces: 1
Annotations:
Annotation #0:
Creator: xpidl 0.99.1
Private Data: I should put something here.
Interface Directory:
- ::nsISupports (00000000-0000-0000-c000-000000000046):
Methods:
uint32 QueryInterface(in void *, out void *);
H uint32 AddRef();
H uint32 Release();
Constants:
No Constants
|
|
Command Line: (verbose)
|
[coop@ivory idl]$ xpt_dump -v nsISupports.xpt
|
|
Output: (verbose)
|
Header:
Magic beans: 5850434f4d0a547970654c69620d0a1a
PASSED
Major version: 1
Minor version: 0
Number of interfaces: 1
File length: 0
Data pool offset: 105
Annotations:
Annotation #0 is private.
Creator: xpidl 0.99.1
Private Data: I should put something here.
Annotation #0 is the last annotation.
Interface Directory:
Interface #0:
IID: 00000000-0000-0000-c000-000000000046
Name: nsISupports
Namespace: none
Address of interface descriptor: 0x804cbf0
Descriptor:
# of Method Descriptors: 3
Method #0:
Name: QueryInterface
Is Getter? FALSE
Is Setter? FALSE
Is Varargs? FALSE
Is Constructor? FALSE
Is Hidden? FALSE
# of arguments: 2
Parameter Descriptors:
Parameter #0:
In Param? TRUE
Out Param? FALSE
Retval? FALSE
Type Descriptor:
Is Pointer? TRUE
Is Unique Pointer? FALSE
Is Reference? FALSE
Tag: 13
Parameter #1:
In Param? FALSE
Out Param? TRUE
Retval? FALSE
Type Descriptor:
Is Pointer? TRUE
Is Unique Pointer? FALSE
Is Reference? FALSE
Tag: 13
Result:
In Param? FALSE
Out Param? FALSE
Retval? FALSE
Type Descriptor:
Is Pointer? FALSE
Is Unique Pointer? FALSE
Is Reference? FALSE
Tag: 6
Method #1:
Name: AddRef
Is Getter? FALSE
Is Setter? FALSE
Is Varargs? FALSE
Is Constructor? FALSE
Is Hidden? TRUE
# of arguments: 0
Parameter Descriptors:
Result:
XXX
In Param? FALSE
Out Param? FALSE
Retval? TRUE
Type Descriptor:
Is Pointer? FALSE
Is Unique Pointer? FALSE
Is Reference? FALSE
Tag: 6
Method #2:
Name: Release
Is Getter? FALSE
Is Setter? FALSE
Is Varargs? FALSE
Is Constructor? FALSE
Is Hidden? TRUE
# of arguments: 0
Parameter Descriptors:
Result:
XXX
In Param? FALSE
Out Param? FALSE
Retval? TRUE
Type Descriptor:
Is Pointer? FALSE
Is Unique Pointer? FALSE
Is Reference? FALSE
Tag: 6
Constants:
No Constants
WARNING: ParamDescriptors are present with bad in/out/retval flag information.
These have been marked with 'XXX'.
Remember, retval params should always be marked as out!
|
xpt_link - the typelib linker
xpt_link is a tool for linking together multiple binary-format
typelib files. The result is ONE BIG TYPELIB containing
a single, resolved (in most cases) entry for each interface that
appeared in the original typelib files.
Source Code:
mozilla/xpcom/typelib/xpt/tools/xpt_link.c
Dependencies:
xpt_link requires both
nspr
(NetScape's Portable Runtime, headers only) and
libxpt
(library of functions for handling type library files).
Command Syntax:
Usage: xpt_link outfile file1.xpt file2.xpt ...
Links multiple typelib files into one outfile
As is visible above, xpt_link takes at least two arguments. The
first argument is the filename of the linked typelib file to be
written. The second, third, ...xth arguments are the filenames of
valid typelib files. Wildcards (e.g. *.xpt) are acceptable as the
second (or any following) argument.
Sample Output:
|
Command Line:
|
[coop@ivory idl]$ xpt_link linked.xpt *.xpt
|
|
Output: (if successful)
|
File written: linked.xpt
View a dump of
linked.xpt created by linking all of
the idl files (compiled to typelibs, of course) in the
mozilla/xpcom/idl/ directory.
|
|
Output: (for a particular failure condition)
|
FATAL ERROR:
Duplicate IID detected (adfb3740-aa57-11d2-b7ed-00805f05ffa5) in
interface ::nsIMsgHost from mailnews_base.xpt
and
interface ::nsINNTPHost from mailnews_news.xpt |
Chris Cooper
Last modified: Tue Mar 30 19:45:05 EST 1999
Slight fixes by Mike McCabe, Fri May 28 03:52:08 PDT 1999
|
|
 |