Pelles C forum

C language => User contributions => Topic started by: frankie on May 03, 2013, 12:49:51 AM

Title: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on May 03, 2013, 12:49:51 AM
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:

03/08/2015 New Release V0.7.0.1a
   Fixed 2 major bugs:
03/08/2015 New Release V0.7.0.2a
   Fixed a major bug (thanks to Timo):
03/09/2015 New Release V0.7.0.4a
   Fixed some minor bugs and added functionalities:
03/13/2015 New Release V0.8.0.0a
   Fixed some minor bugs and added functionalities:P.S. The sample is reposted below.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: TimoVJL on May 03, 2013, 05:52:31 AM
Nice work frankie!

Maybe better using this:
Code: [Select]
HRESULT hRes = LoadTypeLibEx(globals.wszFileName, REGKIND_NONE, &hTypeLib);
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on May 03, 2013, 12:18:43 PM
Thanks Timo.  :)
Yes you are right. Without registration process the scanning could be a little bit faster and guarantee against registry modifications.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: TimoVJL on May 03, 2013, 02:56:43 PM
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*);
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on May 03, 2013, 04:58:14 PM
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.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on May 04, 2013, 09:30:04 PM
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.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on May 12, 2013, 06:55:26 PM
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.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on March 08, 2015, 01:54:04 AM
New version.
Fixed 2 major bugs.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on March 08, 2015, 05:33:35 PM
 V0.7.0.2a 7.Fixed LRH handling.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on March 09, 2015, 04:38:56 PM
 V0.7.0.4a  - Produce documented or undocumented header.
Title: Re: FTypeLib OLE/COM plain 'C' header generator
Post by: frankie on March 13, 2015, 05:20:59 PM
03/13/2015 New Release V0.8.0.0a
   Fixed some minor bugs and added functionalities:The sample has been moved here for space reasons.