betterC DLL in Windows

bachmeier no at spam.net
Sat Feb 4 19:49:41 UTC 2023


On Saturday, 4 February 2023 at 18:40:51 UTC, Tamas wrote:

>> It is hopelessly broken, but thankfully, it also brings zero 
>> benefit, so simply not using it is a viable path forward.
>
> I do take your word for it, but now I have to re-evaluate my 
> expectations towards D and perhaps use it for another project. 
> I've got most of my project working in C already, but I was 
> hoping to add some safety and better readability/managability 
> by using some of the convenient features D offers over C. And, 
> of course, learn D in the process. Also, your words give me the 
> impression that I cannot trust the documentation; which isn't a 
> great start into the learning process.

I'm not sure what Adam's getting at when he says "hopelessly 
broken" but it's basically a subset of D. The main reason I've 
seen people wanting betterC is to avoid the GC. Well, you don't 
need betterC for that, you use @nogc and then you don't have to 
worry about the GC.

>>> 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.
>>
>> Just don't call those functions and they won't hurt you, aside 
>> from adding ~200 KB of size to the dll. On the other hand, the 
>> -betterC switch is hurting you - as evidenced by your own 
>> attempt working until you added it.
>
> It can be evidence of something broken in D as you say 
> (simplified) or of my lack of experience with D - a simple 
> missing include, badly configured PATH, or lack of 
> understanding on my part what SimpleDllMain does.

I think the point is that it works without the betterC switch, so 
it's not your lack of experience that's the problem, it's the 
functionality that you lose when you use that switch.


More information about the Digitalmars-d-learn mailing list