betterC DLL in Windows

Tamas km212121 at
Sat Feb 4 18:11:05 UTC 2023

Hi, thanks for the feedback. I'm happy to see 2 replies so 

On Saturday, 4 February 2023 at 17:26:17 UTC, Adam D Ruppe wrote:
> On Saturday, 4 February 2023 at 16:45:31 UTC, Tamas wrote:
>> export extern (C) void main()
>> mixin SimpleDllMain;
> No need to ever mix two mains together, the DllMain is the 
> required one.

Indeed, that is an oversight on my part. However, that's just a 
typo I happened to include in my last attempt. I use foo() and 
others, and .def exporting them etc. Tried various things based 
on the examples I linked.

>> and they compile without `-betterC`, but fail with link errors 
>> when using the switch.
> then don't use the switch lol
> -betterC is barely supported and completely useless so better 
> to just not use it.

Well, as I'm new to D this isn't something I have insight into. 
However, this being and advertised feature of the language, I'm 
surprised to see that you dismiss it so casually. Also, for my 
project, I mostly need interop with C libraries and D would only 
serve as a glue, so I don't really need several features like GC 
etc. `betterC`, at least what I thought it was supposed to be, 
seemed to be a good fit for what I need.

>> error LNK2019: unresolved external symbol 
>> _D4core3sys7windows3dll18dll_process_attachFPvbZb referenced 
>> in function DllMain
> This is just betterC breaking the code.

Perhaps, but this doesn't help me much.

More information about the Digitalmars-d-learn mailing list