Include .def definition file information for the linker into a .d source file

BoQsc vaidas.boqsc at gmail.com
Thu Nov 25 06:56:38 UTC 2021


On Wednesday, 24 November 2021 at 20:29:36 UTC, Imperatorn wrote:
> On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote:
>> On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe 
>> wrote:
>>> On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote:
>>>> The many times I tried this pragma, it did not even get 
>>>> recognised as pragma at all.
>>>
>>> You need to use `dmd -m32mscoff` or `dmd -m64`. Plain `dmd` 
>>> won't work.
>>>
>>> If -m32mscoff and -m64 still don't work, what's your dmd 
>>> version? It was added in 2.083.0, November 2018.
>>
>> Thanks, seems to work now.
>>
>> I had to add these two pragmas to the `winsamp.d`
>> ```
>> pragma(linkerDirective, "/subsystem:windows");
>> pragma(lib, "user32.lib");
>> ```
>>
>> And as you mentioned give additional`-m32mscoff` flag to the 
>> compiler.
>>
>> `dmd winsamp.d -m32mscoff`
>>
>> **The obvious problem now is:** How can you compile without 
>> specifying the flags. With plain dmd.
>
> Just a quick question before going deeper. Why do you not want 
> to supply the definition file?

To have a single standalone .d script file, that's the end goal.
I want to have everything in one .d source file and run it 
without specifying additional files or flags.
In other words: as simple as possible to use.


More information about the Digitalmars-d-learn mailing list