Re: betterC DLL in Windows

2023-02-06 Thread Tamas via Digitalmars-d-learn
On Monday, 6 February 2023 at 15:54:40 UTC, bachmeier wrote: This is the specification for the D Programming Language. I've been bitten by that a few times over the years, though to be honest, I'm not sure of the relationship of the spec to documentation. The Phobos documentation and

Re: betterC DLL in Windows

2023-02-06 Thread Tamas via Digitalmars-d-learn
On Sunday, 5 February 2023 at 19:00:16 UTC, Richard (Rikki) Andrew Cattermole wrote: So LDC with druntime and yes GC turned on is good enough right now that you can probably make it work without too much effort. You don't necessarily have to limit yourself to -betterC. In fact if you don't,

Re: betterC DLL in Windows

2023-02-06 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Feb 06, 2023 at 03:54:40PM +, bachmeier via Digitalmars-d-learn wrote: > On Sunday, 5 February 2023 at 08:48:34 UTC, Tamas wrote: [...] > > This is the specification for the D Programming Language. > > I've been bitten by that a few times over the years, though to be > honest, I'm

Re: betterC DLL in Windows

2023-02-06 Thread bachmeier via Digitalmars-d-learn
On Sunday, 5 February 2023 at 08:48:34 UTC, Tamas wrote: I appreciate all of this... however, as a newcomer, I wish the docs were simply more honest, instead of representing wishful thinking. I guess in any programming language, experience reveals things not present in the docs, but it seems

Re: betterC DLL in Windows

2023-02-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 05/02/2023 10:01 PM, Tamas wrote: On the surface, betterC seems to be perfect for this case. How would YOU do it (Adam, Richard)? BtW, gstreamer also has D bindings, and maybe in the future I'll use those. I suspect that Adam's suggestions have a stronger relevance to that case, right?

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Sunday, 5 February 2023 at 00:27:19 UTC, Richard (Rikki) Andrew Cattermole wrote: On 05/02/2023 1:20 PM, Adam D Ruppe wrote: Even module imports can fail because betterC disables outputting the module data info, even if it would otherwise be required by language rules, despite it not using

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Sunday, 5 February 2023 at 00:20:24 UTC, Adam D Ruppe wrote: There's a lot of things described in the documentation that don't actually work. D can be an *extremely* productive language if you know which parts to focus on, but most the newer hyped features just don't deliver. The table of

Re: betterC DLL in Windows

2023-02-05 Thread Tamas via Digitalmars-d-learn
On Saturday, 4 February 2023 at 19:44:15 UTC, bachmeier wrote: On Saturday, 4 February 2023 at 18:29:41 UTC, Tamas wrote: What's the reason to prefer LDC over DMD? Anyone that cares about performance will use LDC rather than DMD. It's hard to imagine a case where someone would want betterC

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:40:51 UTC, Tamas wrote: 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

Re: betterC DLL in Windows

2023-02-04 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 05/02/2023 1:20 PM, Adam D Ruppe wrote: Even module imports can fail because betterC disables outputting the module data info, even if it would otherwise be required by language rules, despite it not using the druntime. This only affects you if you use full D to interact with -betterC

Re: betterC DLL in Windows

2023-02-04 Thread ryuukk_ via Digitalmars-d-learn
In betterC mode you don't have access to the standard library or the runtime You can only access the libc functions Basically the modules from: ``import core.stdc`` So for your example, just do like you'd do in C As simple as that As for DMD/LDC, easy: DMD: reference compiler, fast

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 19:49:41 UTC, bachmeier wrote: I'm not sure what Adam's getting at when he says "hopelessly broken" but it's basically a subset of D. You're almost guaranteed to hit some wall with it and have no solution. Some of these are bugs but some of them are by design;

Re: betterC DLL in Windows

2023-02-04 Thread bachmeier via Digitalmars-d-learn
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

Re: betterC DLL in Windows

2023-02-04 Thread bachmeier via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:29:41 UTC, Tamas wrote: What's the reason to prefer LDC over DMD? Anyone that cares about performance will use LDC rather than DMD. It's hard to imagine a case where someone would want betterC to avoid the GC, but they wouldn't want to use LDC. When I

Re: betterC DLL in Windows

2023-02-04 Thread Tamas via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:27:34 UTC, Adam D Ruppe wrote: On Saturday, 4 February 2023 at 18:11:05 UTC, Tamas wrote: Well, as I'm new to D this isn't something I have insight into. Then you'd probably be better off taking my word for it (or even trusting your own limited experience

Re: betterC DLL in Windows

2023-02-04 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 05/02/2023 7:29 AM, Tamas wrote: What's the reason to prefer LDC over DMD? DMD is currently a write off for DLL support (some things do work, but its very easy to hit situations that don't). I've been looking into this for the past year, implemented some things in dub to get it to work,

Re: betterC DLL in Windows

2023-02-04 Thread Tamas via Digitalmars-d-learn
On Saturday, 4 February 2023 at 16:51:36 UTC, Richard (Rikki) Andrew Cattermole wrote: You don't have access to druntime/Phobos stuff at runtime. SimpleDllMain is for initializing and uninitializing druntime. See:

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 18:11:05 UTC, Tamas wrote: Well, as I'm new to D this isn't something I have insight into. Then you'd probably be better off taking my word for it (or even trusting your own limited experience where things worked until you added the switch) and just not using

Re: betterC DLL in Windows

2023-02-04 Thread Tamas via Digitalmars-d-learn
Hi, thanks for the feedback. I'm happy to see 2 replies so quickly. 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

Re: betterC DLL in Windows

2023-02-04 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 4 February 2023 at 16:45:31 UTC, Tamas wrote: 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. export extern (C) void main()

Re: betterC DLL in Windows

2023-02-04 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
You don't have access to druntime/Phobos stuff at runtime. SimpleDllMain is for initializing and uninitializing druntime. See: https://github.com/Project-Sidero/basic_memory/blob/main/source/sidero/base/dllmain.d You want to only use ldc atm. The defaults right now should most likely "just

betterC DLL in Windows

2023-02-04 Thread Tamas via Digitalmars-d-learn
Hi, I'm new to D and trying my hands on a few simple things. Being able to build a Windows DLL with betterC enabled is of particular interest to me, as I'd need it for a project that I'd like to do in D. I'm trying to follow some examples, such as [this](https://wiki.dlang.org