www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - COM type library importer

reply John C <johnch_atms hotmail.com> writes:
I've written an experimental tool that creates a D import module from a 
COM type library.

It should save you from having to convert C headers for COM programming.

Command line options that control the generated source code include:
	/comments - adds type library's helpstrings as comments
	/noenums - omits enum names
	/tabs - uses tabs to indent instead of spaces
	/indent - 10 or fewer indents
	/propget and /propput - prefixes for COM property accessors
	/module - the name of the generated module

Try it out (at your own risk - this is, as I've said, experimental).
http://www.paperocean.org/d/tlibd/

John.
Apr 09 2006
next sibling parent tjohnson at prtsoftware dot com <tjohnson_member pathlink.com> writes:
Whooohooo!

Many thanks.  I'll test it out and let you know how it goes.

Tom


In article <e1b3tk$2etj$1 digitaldaemon.com>, John C says...
I've written an experimental tool that creates a D import module from a 
COM type library.

It should save you from having to convert C headers for COM programming.

Command line options that control the generated source code include:
	/comments - adds type library's helpstrings as comments
	/noenums - omits enum names
	/tabs - uses tabs to indent instead of spaces
	/indent - 10 or fewer indents
	/propget and /propput - prefixes for COM property accessors
	/module - the name of the generated module

Try it out (at your own risk - this is, as I've said, experimental).
http://www.paperocean.org/d/tlibd/

John.
Apr 09 2006
prev sibling next sibling parent reply r <r_member pathlink.com> writes:
In article <e1b3tk$2etj$1 digitaldaemon.com>, John C says...
I've written an experimental tool that creates a D import module from a 
COM type library.

It should save you from having to convert C headers for COM programming.

Command line options that control the generated source code include:
	/comments - adds type library's helpstrings as comments
	/noenums - omits enum names
	/tabs - uses tabs to indent instead of spaces
	/indent - 10 or fewer indents
	/propget and /propput - prefixes for COM property accessors
	/module - the name of the generated module

Try it out (at your own risk - this is, as I've said, experimental).
http://www.paperocean.org/d/tlibd/

John.
this is great! but seems i am not smart enough to use it properly. i ran the program on msado15.dll and added the missing enums. when i try to use the following _Connection oDatabase = Connection.create!(_Connection); oDatabase will always be null. the same is for _Recordset oRecords = Recordset.create!(_Recordset); could you give me some pointers? thanx r
Apr 10 2006
parent reply John C <johnch_atms hotmail.com> writes:
r wrote:
 In article <e1b3tk$2etj$1 digitaldaemon.com>, John C says...
 
I've written an experimental tool that creates a D import module from a 
COM type library.

It should save you from having to convert C headers for COM programming.

Command line options that control the generated source code include:
	/comments - adds type library's helpstrings as comments
	/noenums - omits enum names
	/tabs - uses tabs to indent instead of spaces
	/indent - 10 or fewer indents
	/propget and /propput - prefixes for COM property accessors
	/module - the name of the generated module

Try it out (at your own risk - this is, as I've said, experimental).
http://www.paperocean.org/d/tlibd/

John.
this is great! but seems i am not smart enough to use it properly. i ran the program on msado15.dll and added the missing enums. when i try to use the following _Connection oDatabase = Connection.create!(_Connection); oDatabase will always be null. the same is for _Recordset oRecords = Recordset.create!(_Recordset); could you give me some pointers? thanx r
I'll be uploading a bug-fixed version shortly which correctly generates enums. Ensure you're initializing COM with CoInitialize. I usually do so in a static module ctor, like this: module main; import com; static this() { CoInitialize(null); } static ~this() { CoUninitialize(); } Hope that helps.
Apr 10 2006
next sibling parent r <r_member pathlink.com> writes:
In article <e1eeha$di6$1 digitaldaemon.com>, John C says...
r wrote:
 In article <e1b3tk$2etj$1 digitaldaemon.com>, John C says...
 
I've written an experimental tool that creates a D import module from a 
COM type library.

It should save you from having to convert C headers for COM programming.

Command line options that control the generated source code include:
	/comments - adds type library's helpstrings as comments
	/noenums - omits enum names
	/tabs - uses tabs to indent instead of spaces
	/indent - 10 or fewer indents
	/propget and /propput - prefixes for COM property accessors
	/module - the name of the generated module

Try it out (at your own risk - this is, as I've said, experimental).
http://www.paperocean.org/d/tlibd/

John.
this is great! but seems i am not smart enough to use it properly. i ran the program on msado15.dll and added the missing enums. when i try to use the following _Connection oDatabase = Connection.create!(_Connection); oDatabase will always be null. the same is for _Recordset oRecords = Recordset.create!(_Recordset); could you give me some pointers? thanx r
I'll be uploading a bug-fixed version shortly which correctly generates enums. Ensure you're initializing COM with CoInitialize. I usually do so in a static module ctor, like this: module main; import com; static this() { CoInitialize(null); } static ~this() { CoUninitialize(); } Hope that helps.
thanx, it helped. r
Apr 10 2006
prev sibling parent reply Carlos Santander <csantander619 gmail.com> writes:
John C escribió:
 
 Ensure you're initializing COM with CoInitialize. I usually do so in a 
 static module ctor, like this:
 
     module main;
 
     import com;
 
     static this() {
         CoInitialize(null);
     }
 
     static ~this() {
         CoUninitialize();
     }
 
A suggestion: wouldn't it be better to have those in your com module? I mean, they're going to be needed anyway, so why not make things easier for users? -- Carlos Santander Bernal
Apr 11 2006
parent John C <johnch_atms hotmail.com> writes:
Carlos Santander wrote:
 John C escribió:
 
 Ensure you're initializing COM with CoInitialize. I usually do so in a 
 static module ctor, like this:

     module main;

     import com;

     static this() {
         CoInitialize(null);
     }

     static ~this() {
         CoUninitialize();
     }
A suggestion: wouldn't it be better to have those in your com module? I mean, they're going to be needed anyway, so why not make things easier for users?
I agree. I'll make the change.
Apr 11 2006
prev sibling parent John C <johnch_atms hotmail.com> writes:
TLibD v0.15 is now ready. I've been concentrating on making it generate 
code that can be compiled without errors or having to hand-edit it.

The zip file contains the source code if you're wondering how it's done. 
It's not too pretty, though.

http://www.paperocean.org/d/tlibd/

John.
Apr 12 2006