Yet another effort at translating the Win32 API headers

Don Clugston dac at nospam.com.au
Fri Mar 31 07:33:46 PST 2006


Stewart Gordon wrote:
> Don Clugston wrote:
>> Hi Stewart,
>> Here's a translation of wingdi, one of the largest headers.
>> It doesn't yet _fully_ comply with your requirements (although I think 
>> it's not too bad), but I'm loathe to modify it further without better 
>> testing. It was a lot of work already to get it to that stage. I think 
>> we need to get some of the early headers in Windows.h done, so that 
>> the later ones can compile.
> <snip>
> 
> I've just had a look.  I hadn't really thought about testing the 
> translation, with there being so much to test and bits of the API to get 
> to grips with in doing so.

What would be great would be a 'force extern' dmd option for linking: 
ensure that every extern function actually exists in the import library.
Right now you can write:
extern (Windows) { void SomeOldGarbage(); }
and it will compile without error. If we had such a feature, we could at 
least check that all functions were defined correctly.

One way of doing it would be take one of those Dparser projects and just 
create a main() function which creates function pointers to every 
function mentioned in the file. But obviously it would be better if 
Walter could create an option to do the same thing. It would help all 
conversion from C->D.

> I see you've begun to implement your "interim solution" on the Windows 
> versions....

I didn't use the Perl script, I used my half-baked C2D converter to do 
the initial conversion. It's a moderately correct preprocessor with an 
regex replacement of the simple D types. #ifdef to static if is 
something it does semi-automatically.

I still don't know what's the right way to do it. Function definitions 
are OK, but those structs that have additional members...



More information about the Digitalmars-d-announce mailing list