Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
April 09, 2006 COM type library importer | ||||
---|---|---|---|---|
| ||||
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. |
April 10, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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. |
April 10, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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 |
April 10, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to r | 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.
|
April 11, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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 |
April 11, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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 |
April 11, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander | 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.
|
April 12, 2006 Re: COM type library importer | ||||
---|---|---|---|---|
| ||||
Posted in reply to John C | 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. |
Copyright © 1999-2021 by the D Language Foundation