www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Win32 DLLs in D

reply Poyeyo <poyeyo arcadechaser.com> writes:
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.
Jun 05 2020
next sibling parent Andre Pany <andre s-e-a-p.de> writes:
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
Jun 05 2020
prev sibling parent =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
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
Jun 05 2020