www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What is the Most Effective Tool to Convert WinAPI Headers?

reply starcanopy <starcanopy protonmail.com> writes:
I'm currently working on a Phobos issue that necessitates a 
function whose declaration is found in Fileapi.h. Unfortunately, 
druntime doesn't contain the header's D counterpart. I know there 
are a few tools to help automate this process, but which one 
would has been known to work well with Windows' headers?
Oct 12 2020
next sibling parent starcanopy <starcanopy protonmail.com> writes:
Dang. Should've posted this in learn.
Oct 12 2020
prev sibling next sibling parent reply 12345swordy <alexanderheistermann gmail.com> writes:
On Monday, 12 October 2020 at 17:28:39 UTC, starcanopy wrote:
 I'm currently working on a Phobos issue that necessitates a 
 function whose declaration is found in Fileapi.h. 
 Unfortunately, druntime doesn't contain the header's D 
 counterpart. I know there are a few tools to help automate this 
 process, but which one would has been known to work well with 
 Windows' headers?
Try using the dpp library. -Alex
Oct 12 2020
parent reply starcanopy <starcanopy protonmail.com> writes:
On Monday, 12 October 2020 at 18:04:12 UTC, 12345swordy wrote:
 On Monday, 12 October 2020 at 17:28:39 UTC, starcanopy wrote:
 I'm currently working on a Phobos issue that necessitates a 
 function whose declaration is found in Fileapi.h. 
 Unfortunately, druntime doesn't contain the header's D 
 counterpart. I know there are a few tools to help automate 
 this process, but which one would has been known to work well 
 with Windows' headers?
Try using the dpp library. -Alex
It's been a while, but I'll give it a shot. Never had much luck with it, even for macro-lite headers. Thanks.
Oct 13 2020
parent Jacob Carlborg <doob me.com> writes:
On 2020-10-13 18:09, starcanopy wrote:

 It's been a while, but I'll give it a shot. Never had much luck with it, 
 even for macro-lite headers. Thanks.
You could try DStep [1] as well. [1] https://github.com/jacob-carlborg/dstep -- /Jacob Carlborg
Oct 16 2020
prev sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 13/10/2020 6:28 AM, starcanopy wrote:
 I'm currently working on a Phobos issue that necessitates a function 
 whose declaration is found in Fileapi.h. Unfortunately, druntime doesn't 
 contain the header's D counterpart. I know there are a few tools to help 
 automate this process, but which one would has been known to work well 
 with Windows' headers?
You shouldn't need a tool for this. It looks pretty straight forward to writing a binding for it. https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/fileapi.h
Oct 12 2020
parent reply starcanopy <starcanopy protonmail.com> writes:
On Tuesday, 13 October 2020 at 00:46:32 UTC, rikki cattermole 
wrote:
 On 13/10/2020 6:28 AM, starcanopy wrote:
 I'm currently working on a Phobos issue that necessitates a 
 function whose declaration is found in Fileapi.h. 
 Unfortunately, druntime doesn't contain the header's D 
 counterpart. I know there are a few tools to help automate 
 this process, but which one would has been known to work well 
 with Windows' headers?
You shouldn't need a tool for this. It looks pretty straight forward to writing a binding for it. https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/include/fileapi.h
True, but I've been meaning to familiarize myself with the pertinent tooling, and this is an okay-ish example for such a purpose. Worst-case I'll do it "by hand."
Oct 13 2020
parent reply DanielG <simpletangent gmail.com> writes:
Ideally somebody would create a WinRT "projection" for Dlang. As 
I understand it there are some metadata (winmd) files that 
describe the full COM API surface, so idiomatic binding 
generation can be automated.

I've not gone any deeper but on the surface it sounds roughly 
similar to how GTK bindings are produced from GIR metadata.
Oct 13 2020
next sibling parent Paulo Pinto <pjmlp progtools.org> writes:
On Wednesday, 14 October 2020 at 04:49:14 UTC, DanielG wrote:
 Ideally somebody would create a WinRT "projection" for Dlang. 
 As I understand it there are some metadata (winmd) files that 
 describe the full COM API surface, so idiomatic binding 
 generation can be automated.

 I've not gone any deeper but on the surface it sounds roughly 
 similar to how GTK bindings are produced from GIR metadata.
Indeed, it is the next COM major improvement. Basically .NET metadata replaces COM type libraries (TLB), and in the process COM ABI was extended to support basically anything from Common Language Subset (CLS) from .NET (as in types). So UWP also supports enumerations and generics for example. Initially the support for projections was built into .NET, Chakra and VC++ toolings, while everyone else was left wondering how to make them. Now with that whole Project Reunion reboot of the stack, that infrastructure is available for others. You can start here, https://github.com/microsoft/xlang With parser and all Windows SDK first party languages available to learn from.
Oct 14 2020
prev sibling parent Andre Pany <andre s-e-a-p.de> writes:
On Wednesday, 14 October 2020 at 04:49:14 UTC, DanielG wrote:
 Ideally somebody would create a WinRT "projection" for Dlang. 
 As I understand it there are some metadata (winmd) files that 
 describe the full COM API surface, so idiomatic binding 
 generation can be automated.

 I've not gone any deeper but on the surface it sounds roughly 
 similar to how GTK bindings are produced from GIR metadata.
There is some work done here by WebFreak https://github.com/WebFreak001/dwinrt And also here: https://github.com/LightBender/DWinRT Kind regards Andre
Oct 14 2020