Sometime ago Timovjl asked me if could be a good idea to concentrate some development efforts on OLE/COM technologies. Following this Idea I wrote this software.
This program scans type libraries and produce a 'C' header that can then be used to write programs with OLE/COM functionalities under plain 'C'.
This allows to use any control or COM object even when you don't have the IDL descriptor (and don't want to fight with MS bloated headers).
Of course to use an object you must know what it does and you must know the OLE/COM object programming. To learn about OLE/COM I suggest to read the excellent articles from Jeff Glatt on codeproject.com (http://codeproject.com).
This is an alpha release with some known limitations:
1. The program don't looks for definition order, some type definitions can follow their usage. In this case you have to manually reorder the record or unions definition.
2. Actually stub and proxies are not emitted.
The stubs and proxies are functions that are directly available from COM DLL's and are callable without using lpvtbl's.
Of course there will be some other bugs that I've not discovered yet. I'll be glad if you would report them.
In the thread you will also find the sample 'SimpleWebPage' that use the headers generated with FTypeLib.
'SimpleWebPage' is a demo from Jeff Glatt adapted and revised. You will find in the comments some notes about the use of FTypeLib.
05/04/2013 New Release V0.5.9.0a
05/12/2013 New Release V0.6.9.1a:
Completely rewrote the function generation. The previous one was very buggy.
- Fixed Interface generation for bugs, and fixed the GUID generation
- Added structures predefinitions to reduce manual adjustments on generated headers
- The sample use *only* FtypeLib generated headers
- This code is original and doesn't resemble anymore any previous work (too much bugs there)
03/08/2015 New Release V0.7.0.1a
Fixed 2 major bugs:
In not dual interfaces methods inherited from interfaces other than IDispatch and IUnknown were dropped. Now all inherited methods are correctly added.
- The property get methods don't used pointers. Corrected.
03/08/2015 New Release V0.7.0.2a
Fixed a major bug (thanks to Timo):
The LRH (Last Right Hand Method) was not correctly handed when interface class had inherited members. Fixed.
03/09/2015 New Release V0.7.0.4a
Fixed some minor bugs and added functionalities:
Now you can select if to emit documented or undocumented code, using Settings menu.
03/13/2015 New Release V0.8.0.0a
Fixed some minor bugs and added functionalities:
32 and 64 bits versions
Addin for PellesC IDE to replace old and limited TypeLib addin
Better GUI
Generated code now is \n separated for correct file encoding (removed dangling \r in header files).
The result from generation is a standard malloced memory that user can free with free() without using dynamic strings functions.
Dynamic strings library tuned for faster code
P.S. The sample is reposted below.
Nice work frankie!
Maybe better using this:
HRESULT hRes = LoadTypeLibEx(globals.wszFileName, REGKIND_NONE, &hTypeLib);
Thanks Timo. :)
Yes you are right. Without registration process the scanning could be a little bit faster and guarantee against registry modifications.
COM functions should always return HRESULT ??
Examples:
MSScript.ocx
- VOID (*put_Language)(IScriptControl *This, BSTR Language);
+ HRESULT (*put_Language)(IScriptControl *This, BSTR Language);
- VARIANT (*Eval)(IScriptControl *This, BSTR Expression);
+ HRESULT (*Eval)(IScriptControl *This, BSTR Expression, VARIANT*);
Thanks Timo.
I'll look again the proto generation for put properties and the handling of 'retval'.
I'll be back with a new version.
Above you'll find the new release V0.5.9.0a
I fixed almost all reported issues (I hope).
As a new feature now the header comments are doxygen compliant. So you can run doxygen and create documentation.
Please test it and report problems found.
For a next release I would add a feature that builds a 'C' file with skeleton of an interface. A list will show all available interfaces to selected the one for wich to build the skeleton.
Above you'll find a new release V0.6.9.1a of FTypeLib.
Timo about your former comments you will find the answers in the code comments.
Everybody please help to debug.
New version.
Fixed 2 major bugs.
V0.7.0.2a 7.Fixed LRH handling.
V0.7.0.4a - Produce documented or undocumented header.
03/13/2015 New Release V0.8.0.0a
Fixed some minor bugs and added functionalities:
32 and 64 bits versions
Addin for PellesC IDE to replace old and limited TypeLib addin
Better GUI
Generated code now is \n separated for correct file encoding (removed dangling \r in header files).
The result from generation is a standard malloced memory that user can free with free() without using dynamic strings functions.
Dynamic strings library tuned for faster code
The sample has been moved here for space reasons.