Thread overview
How can I request smthg related to the Win run-time ?
Mar 04, 2013
D-Ratiseur
Mar 04, 2013
D-ratiseur
Mar 04, 2013
cal
Mar 05, 2013
Mike Parker
Mar 05, 2013
Kapps
March 04, 2013
Hello, I've noticed that an important function (and probably a few others) is missing from Windows.d (SetEndOfFile). I'd like to put a FR about this but I don't know where-how. Should I register here "http://d.puremagic.com/issues/enter_bug.cgi?product=D" for such a stuff (which is not a bug BTW).
Thx.
March 04, 2013
On Mon, 04 Mar 2013 10:24:50 -0500, D-Ratiseur <ThisAdressDoesntExist@nowhere.fr> wrote:

> Hello, I've noticed that an important function (and probably a few others) is missing from Windows.d (SetEndOfFile). I'd like to put a FR about this but I don't know where-how. Should I register here "http://d.puremagic.com/issues/enter_bug.cgi?product=D" for such a stuff (which is not a bug BTW).
> Thx.

Generally, Windows.d is not a complete list.  It's just a list of functions from windows core libraries that have been used in Phobos/Druntime.  Things get added as they are needed.

Note that the function you want is still present, you just have to declare a prototype for it (that is all Windows.d does).

I think at some point someone was trying to create a complete header for all windows runtime functions, but I don't know the status of that.

If you want to file a bug for this, you can, just mark it as an enhancement.

-Steve
March 04, 2013
On Monday, 4 March 2013 at 15:49:20 UTC, Steven Schveighoffer
wrote:
> On Mon, 04 Mar 2013 10:24:50 -0500, D-Ratiseur <ThisAdressDoesntExist@nowhere.fr> wrote:
>
>> Hello, I've noticed that an important function (and probably a few others) is missing from Windows.d (SetEndOfFile). I'd like to put a FR about this but I don't know where-how. Should I register here "http://d.puremagic.com/issues/enter_bug.cgi?product=D" for such a stuff (which is not a bug BTW).
>> Thx.
>
> Generally, Windows.d is not a complete list.  It's just a list of functions from windows core libraries that have been used in Phobos/Druntime.  Things get added as they are needed.
>
> Note that the function you want is still present, you just have to declare a prototype for it (that is all Windows.d does).
>
> I think at some point someone was trying to create a complete header for all windows runtime functions, but I don't know the status of that.
>
> If you want to file a bug for this, you can, just mark it as an enhancement.
>
> -Steve

Ok, thx, I've created the prototype and also tried to dynamically
link the method. It's true that SetEndOfFile is not used at all
in Phobos, that's explain well why the proto is not declared.
March 04, 2013
On Monday, 4 March 2013 at 16:28:36 UTC, D-ratiseur wrote:
> Ok, thx, I've created the prototype and also tried to dynamically
> link the method. It's true that SetEndOfFile is not used at all
> in Phobos, that's explain well why the proto is not declared.

Note you shouldn't need to dynamically link, dmd will link against Kernel32.lib anyway. Declaring the proto is enough.

March 05, 2013
On Monday, 4 March 2013 at 18:27:47 UTC, cal wrote:
> On Monday, 4 March 2013 at 16:28:36 UTC, D-ratiseur wrote:
>> Ok, thx, I've created the prototype and also tried to dynamically
>> link the method. It's true that SetEndOfFile is not used at all
>> in Phobos, that's explain well why the proto is not declared.
>
> Note you shouldn't need to dynamically link, dmd will link against Kernel32.lib anyway. Declaring the proto is enough.

In this particular instance that is true, but I've found that it's not always the case. The Win32 link libraries that ship with DMD seem to be rather old (unless they've been updated in the last year or so). I haven't dug into it too deeply, but I'm guessing they're based on the XP era of the API and anything added since Vista isn't going to be exposed. That will cause link errors. I encountered this with some of the post-XP functions in shell32.lib and had to resort to loading them dynamically.
March 05, 2013
On Tuesday, 5 March 2013 at 08:08:27 UTC, Mike Parker wrote:
> On Monday, 4 March 2013 at 18:27:47 UTC, cal wrote:
>> On Monday, 4 March 2013 at 16:28:36 UTC, D-ratiseur wrote:
>>> Ok, thx, I've created the prototype and also tried to dynamically
>>> link the method. It's true that SetEndOfFile is not used at all
>>> in Phobos, that's explain well why the proto is not declared.
>>
>> Note you shouldn't need to dynamically link, dmd will link against Kernel32.lib anyway. Declaring the proto is enough.
>
> In this particular instance that is true, but I've found that it's not always the case. The Win32 link libraries that ship with DMD seem to be rather old (unless they've been updated in the last year or so). I haven't dug into it too deeply, but I'm guessing they're based on the XP era of the API and anything added since Vista isn't going to be exposed. That will cause link errors. I encountered this with some of the post-XP functions in shell32.lib and had to resort to loading them dynamically.

You can also just use coffimplib and link to them statically, that's the approach I used.

Though I suppose this might be confusing when someone else tries compiling your code...