April 01, 2019
On Monday, 1 April 2019 at 21:10:20 UTC, Mike Parker wrote:
> While it would be possible to add a lib pragma to every system module in DRuntime so that the appropriate library is automatically linked when the module is imported, that’s not currently the case.

I count 62 `pragma(lib, ...)` in druntime, incl. advapi32 [1]. Missing ones can be seen as a bug, or at the very least an unnecessary inconvenience.

[1] https://github.com/dlang/druntime/blob/aa39818f2805d7406d06c9fc74b7903789ca13ac/src/core/sys/windows/aclapi.d#L14
April 01, 2019
On Mon, Apr 01, 2019 at 09:46:51PM +0000, kinke via Digitalmars-d wrote:
> I count 62 `pragma(lib, ...)` in druntime, incl. advapi32 [1]. Missing ones can be seen as a bug, or at the very least an unnecessary inconvenience.

So yes and no. I agree they should be there, but they are unlikely to actually work because the druntime modules are not in the active build and thus their pragmas don't apply.

April 02, 2019
On Tuesday, 2 April 2019 at 01:18:54 UTC, destructionator wrote:
> On Mon, Apr 01, 2019 at 09:46:51PM +0000, kinke via Digitalmars-d wrote:
>> I count 62 `pragma(lib, ...)` in druntime, incl. advapi32 [1]. Missing ones can be seen as a bug, or at the very least an unnecessary inconvenience.
>
> So yes and no. I agree they should be there, but they are unlikely to actually work because the druntime modules are not in the active build and thus their pragmas don't apply.

Yeah, I was surprised to learn that they are there. I've had to link with certain system libs on Windows as recently as a few months ago and had simply assumed the pragmas weren't there.
April 02, 2019
On Monday, 1 April 2019 at 19:08:01 UTC, kinke wrote:
> Then all that's missing is a `pragma(lib, "advapi32")` in the module referencing these functions; is that druntime?

It worked, thanks a lot.
April 02, 2019
On Monday, 1 April 2019 at 21:10:20 UTC, Mike Parker wrote:

> Right. That’s how the compile-link model works. While it would be possible to add a lib pragma to every system module in DRuntime so that the appropriate library is automatically linked when the module is imported, that’s not currently the case. So you do have to provide them to the linker.
>
> When using Optlink, some commonly system libs are automatically linked, like kernel32 for example, but not when using the MS linker.

I see, thank you for explaining that.
1 2
Next ›   Last »