Thread overview
Win32 DLLs in D
Jun 05, 2020
Poyeyo
Jun 05, 2020
Andre Pany
June 05, 2020
Hello everyone.

I want to create a windows plugin.dll that could be called from rFactor, and I want to try D first, instead of going directly to C++ as the rFactor example.

I am trying to wrap my head around this:

https://wiki.dlang.org/Win32_DLLs_in_D

... which seems quite outdated,

and this:

https://forum.dlang.org/post/mscgsclxwtjcferfxoet@forum.dlang.org

... which seems incomplete,

... and dub, which makes a mess of all my efforts.

Can someone with the right knowledge please update the wiki with a modern example that also uses dub for both the Dll and the test program?

Dub is not a requirement, just a convenience that would be much appreciated.

Best regards.
June 05, 2020
On Friday, 5 June 2020 at 18:00:40 UTC, Poyeyo wrote:
> Hello everyone.
>
> I want to create a windows plugin.dll that could be called from rFactor, and I want to try D first, instead of going directly to C++ as the rFactor example.
>
> I am trying to wrap my head around this:
>
> https://wiki.dlang.org/Win32_DLLs_in_D
>
> ... which seems quite outdated,
>
> and this:
>
> https://forum.dlang.org/post/mscgsclxwtjcferfxoet@forum.dlang.org
>
> ... which seems incomplete,
>
> ... and dub, which makes a mess of all my efforts.
>
> Can someone with the right knowledge please update the wiki with a modern example that also uses dub for both the Dll and the test program?
>
> Dub is not a requirement, just a convenience that would be much appreciated.
>
> Best regards.

Hi,

Create a new dub package with dub init and afterwards change the filename app.d to lib.d. Use as file content

``` d
import core.sys.windows.dll;
mixin SimpleDllMain

extern(C) void sample() nothrow
{
}
```

In dub.json set targetType to "dynamicLibrary".

Build with `dub build`

(Written from my mobile, with the knowledge, as far as I remember).

Kind regards
Andre
June 06, 2020
On Friday, 5 June 2020 at 18:00:40 UTC, Poyeyo wrote:
> Hello everyone.
>
> I want to create a windows plugin.dll that could be called from rFactor, and I want to try D first, instead of going directly to C++ as the rFactor example.
>
> I am trying to wrap my head around this:
>
> https://wiki.dlang.org/Win32_DLLs_in_D
>
> ... which seems quite outdated,
>
> and this:
>
> https://forum.dlang.org/post/mscgsclxwtjcferfxoet@forum.dlang.org
>
> ... which seems incomplete,
>
> ... and dub, which makes a mess of all my efforts.
>
> Can someone with the right knowledge please update the wiki with a modern example that also uses dub for both the Dll and the test program?
>
> Dub is not a requirement, just a convenience that would be much appreciated.
>
> Best regards.

D language dll example.
Creating DLL for hook create, activate, destroy window and hook keyboard events.

https://github.com/vitalfadeev/dlang-dll