COM type library importer

John C johnch_atms at hotmail.com
Mon Apr 10 13:17:44 PDT 2006


r wrote:
> In article <e1b3tk$2etj$1 at 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.



More information about the Digitalmars-d-announce mailing list