Trick: Count the Number of API in COM


Delphi is a handy tool to develop the COM (Component Object Model) DLL. A *_TLB.pas will be generated by the compiler automatically from the *.tlb (Type Library File) which contains the definitions of the functions/procedures, properties.

The *_TLB.pas looks like the following (functions blurred for NDA)

count2 Trick: Count the Number of API in COM beginner delphi programming languages tools / utilities tricks windows

Each API is marked with a keyword dispid that tells the position of the function/procedure/property in the DLL file (e.g. offset). We can count how many times the dispid appear in the file and get the number of APIs we’ve got.

count Trick: Count the Number of API in COM beginner delphi programming languages tools / utilities tricks windows

We can use the linux command grep (there are windows alternatives, such as gnu linux, cygwin) to search all occurrences and pipe into the wc which counts the incoming text/source. The switch option -l tells the wc to count the lines. -w is to count the words and -c stands for characters.

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
258 words
Last Post: Inline in Delphi
Next Post: Floating Point Optimization Comparison in Delphi 2007 and XE3

The Permanent URL is: Trick: Count the Number of API in COM

Leave a Reply