Accessing COM Objects

John via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 14 04:55:44 PDT 2016


On Monday, 13 June 2016 at 19:26:08 UTC, Incognito wrote:
> On Monday, 13 June 2016 at 19:11:59 UTC, John wrote:
>> On Monday, 13 June 2016 at 17:38:41 UTC, Incognito wrote:
>>> Cool. Oleview gives me the idl files. How to convert the idl 
>>> files to d or possibly c?
>>>
>>> Would I just use them in place of IUnknown once I have the 
>>> interface?
>>
>> In OleView you can save the IDL file, then run another tool, 
>> midl.exe, on the IDL file. That will generate the C headers. 
>> But you'd then have to translate that to D by hand.
>>
>> I have written a tool that takes a COM type library and 
>> automatically converts it to a D source file. I could finish 
>> it off over the next few days and put the source on GitHub if 
>> you're interested.
>
> That would be great! With it I might be able to put a nice 
> wrapper around Photoshop for use with D. Others mind find it 
> useful too as other programs still use COM.

It's up: https://github.com/jsatellite/tlb2d/tree/master/src/tlb2d

There's probably a few bugs, and type libraries have a tendency 
to re-define existing types so you'll have to comment those out. 
Also it doesn't generate dependencies, but it does list them at 
the top of the generated module so you can run the tool on those 
type libraries manually.


More information about the Digitalmars-d-learn mailing list