Re: Using bindbc-sdl with D

2023-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 12/03/2023 4:27 PM, idsize wrote: On Sunday, 12 March 2023 at 02:24:31 UTC, Richard (Rikki) Andrew Cattermole wrote: If you add the appropriate versions and copy the files to your project directory (including bindbc-loader) that should work however as long as you compile it in. I've never

Re: Using bindbc-sdl with D

2023-03-11 Thread idsize via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:24:31 UTC, Richard (Rikki) Andrew Cattermole wrote: If you add the appropriate versions and copy the files to your project directory (including bindbc-loader) that should work however as long as you compile it in. I've never used a package manager before so the e

Re: Using bindbc-sdl with D

2023-03-11 Thread idsize via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:52:27 UTC, ryuukk_ wrote: On Sunday, 12 March 2023 at 02:12:45 UTC, idsize wrote: [...] Hello, and welcome! Looks like the new version of that library is broken, i am having the same issue [...] Thanks! It compiled and ran your example successfully.

Re: Using bindbc-sdl with D

2023-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 12/03/2023 4:01 PM, ryuukk_ wrote: So this is a dub issue? Nope, dub is doing everything ok, this is for ImportC. It is able to find the linker, why can't it find the preprocessor? Its probably not installed. We don't ship a C toolchain, it uses the system one (MSVC, which you would nor

Re: Using bindbc-sdl with D

2023-03-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:59:20 UTC, Richard (Rikki) Andrew Cattermole wrote: On 12/03/2023 3:24 PM, Richard (Rikki) Andrew Cattermole wrote: But ugh that error looks weird. That would imply its trying to run the C preprocessor for ImportC. That does not sound right at all, I don't see any

Re: Using bindbc-sdl with D

2023-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 12/03/2023 3:24 PM, Richard (Rikki) Andrew Cattermole wrote: But ugh that error looks weird. That would imply its trying to run the C preprocessor for ImportC. That does not sound right at all, I don't see any C headers/code in bindbc-sdl repo (not that it needs it). Gonna need to see the en

Re: Using bindbc-sdl with D

2023-03-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:12:45 UTC, idsize wrote: I started learning D a few weeks ago and am enjoying it so far. I would like to use SDL with D and found bindbc-sdl, but I cannot figure out how to make it work. From my understanding, I'll need to use 'dub fetch bindbc-sdl' to download

Re: Using bindbc-sdl with D

2023-03-11 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 12/03/2023 3:12 PM, idsize wrote: I started learning D a few weeks ago and am enjoying it so far. I would like to use SDL with D and found bindbc-sdl, but I cannot figure out how to make it work. Welcome! From my understanding, I'll need to use 'dub fetch bindbc-sdl' to download it, and

Using bindbc-sdl with D

2023-03-11 Thread idsize via Digitalmars-d-learn
I started learning D a few weeks ago and am enjoying it so far. I would like to use SDL with D and found bindbc-sdl, but I cannot figure out how to make it work. From my understanding, I'll need to use 'dub fetch bindbc-sdl' to download it, and then run 'dub build bindbc-sdl' to build it, bef

Re: Best way to read/write Chinese (GBK/GB18030) files?

2023-03-11 Thread zjh via Digitalmars-d-learn
On Saturday, 11 March 2023 at 19:56:09 UTC, 0xEAB wrote: If you desire to use other encodings, how about using ubyte + ubyte[]? There is no example. An example should be added in an obvious position. I tried for a long time, but couldn't output `gbk`, and I finally gave up.

Re: @nogc and Phobos

2023-03-11 Thread rempas via Digitalmars-d-learn
On Saturday, 11 March 2023 at 16:21:40 UTC, bomat wrote: first: I didn't want to sound aggressive or like I was trying to bash D, sorry if it came across like that. Oh don't worry! People have openly criticized (and still doing) the language before. It's nothing to worry, criticism help us be

Re: @nogc and Phobos

2023-03-11 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Mar 11, 2023 at 04:21:40PM +, bomat via Digitalmars-d-learn wrote: [...] > Although I come from a C++ background, I'm not exactly a fanboy of > that language (you can probably tell, otherwise I wouldn't be here). > But after hearing praise for D for being a cleaner and better version >

Re: Best way to read/write Chinese (GBK/GB18030) files?

2023-03-11 Thread 0xEAB via Digitalmars-d-learn
On Friday, 10 March 2023 at 07:16:32 UTC, zjh wrote: `D language` is too unfriendly for Chinese users! You can't even write `gbk` files. D’s char + string types are Unicode. To quote the tour, “In D, *all* strings are Unicode strings”. If you desire to use other encodings, how about using ubyt

Re: @nogc and Phobos

2023-03-11 Thread bomat via Digitalmars-d-learn
On Saturday, 11 March 2023 at 13:18:13 UTC, rempas wrote: Even if the first was the case (which again, only things that need the GC will not be able to be used), D is far from been "useless". You can use `betterC` and use C's libraries. Personally, that's what I'm doing anyway. Even if there wa

Re: @nogc and Phobos

2023-03-11 Thread bomat via Digitalmars-d-learn
Thanks for the responses everyone, that was all very helpful and got me on the right track. Especially this: On Saturday, 11 March 2023 at 14:41:01 UTC, Steven Schveighoffer wrote: I think it is an error to mark a library which centers on callbacks with always being @nogc. You can work around

Re: @nogc and Phobos

2023-03-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/11/23 7:04 AM, bomat wrote: Hi all, I am a C++ programmer in my "day job" and was playing around with D to maybe use it in a personal project. I'm using Dear ImGui for the graphical user interface, for which I use this port: https://github.com/KytoDragon/imgui/ It works fairly well so

Re: How can I get the scalar type of a pointer to pointer (and in even deeper levels)

2023-03-11 Thread rempas via Digitalmars-d-learn
On Saturday, 11 March 2023 at 13:37:26 UTC, ag0aep6g wrote: On 11.03.23 14:22, rempas wrote: On Saturday, 11 March 2023 at 12:59:59 UTC, ag0aep6g wrote: alias Foo(T : U*, U) = Foo!U; alias Foo(T) = T; static assert(is(Foo!(int*) == int)); static assert(is(Foo!(int**) == int)); static assert(is

Re: How can I get the scalar type of a pointer to pointer (and in even deeper levels)

2023-03-11 Thread ag0aep6g via Digitalmars-d-learn
On 11.03.23 14:22, rempas wrote: On Saturday, 11 March 2023 at 12:59:59 UTC, ag0aep6g wrote: alias Foo(T : U*, U) = Foo!U; alias Foo(T) = T; static assert(is(Foo!(int*) == int)); static assert(is(Foo!(int**) == int)); static assert(is(Foo!(int***) == int)); static assert(is(Foo!(int) == int

Re: vibe.d

2023-03-11 Thread seany via Digitalmars-d-learn
On Saturday, 11 March 2023 at 12:56:16 UTC, Steven Schveighoffer wrote: On 3/11/23 5:12 AM, seany wrote: email.headers["Sender"] = "<"; // valid mail Looks like an extra `<`, is that correct? No, i mistyped that when i changed the email address after copying it in here. The original co

Re: @nogc and Phobos

2023-03-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 March 2023 at 12:04:25 UTC, bomat wrote: So my question is: Is Phobos essentially incompatible to `@nogc`? Or is there a trick for mixing GC code with non-GC code that I don't know? I'm assuming the second, for if the first was true I'd say that D would be pretty much useless

Re: How can I get the scalar type of a pointer to pointer (and in even deeper levels)

2023-03-11 Thread rempas via Digitalmars-d-learn
On Saturday, 11 March 2023 at 12:59:59 UTC, ag0aep6g wrote: alias Foo(T : U*, U) = Foo!U; alias Foo(T) = T; static assert(is(Foo!(int*) == int)); static assert(is(Foo!(int**) == int)); static assert(is(Foo!(int***) == int)); static assert(is(Foo!(int) == int)); Wait, but "Foo" is defined t

Re: @nogc and Phobos

2023-03-11 Thread rempas via Digitalmars-d-learn
On Saturday, 11 March 2023 at 12:04:25 UTC, bomat wrote: Hello! First of all, let's start by making clear of what `@nogc` means. It it an attribute that is used one function signatures and it annotates that the garbage collector will not be used inside this function. However, in the scenario t

Re: How can I get the scalar type of a pointer to pointer (and in even deeper levels)

2023-03-11 Thread ag0aep6g via Digitalmars-d-learn
On 11.03.23 13:49, rempas wrote: but what about pointers to pointers like: `int`? Is there a way that I would be able to always get the scalar type of a pointer regardless of how many levels it is? As always, I'm searching for a solution that will work in `BetterC`. alias Foo(T : U*, U)

Re: vibe.d

2023-03-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/11/23 5:12 AM, seany wrote: email.headers["Sender"] = "<"; // valid mail Looks like an extra `<`, is that correct? Exception while handling request POST /createNewOwner: object.Exception@/home/monsoon/.dub/packages/vibe-d-0.9.6-alpha.1/vibe-d/tls/vibe/stream/openssl.d(668): Connectin

How can I get the scalar type of a pointer to pointer (and in even deeper levels)

2023-03-11 Thread rempas via Digitalmars-d-learn
Let's see the following code: ```d void test_fn(T)(T val) { pragma(msg, "The type of the pointer is: " ~ typeof(*val).stringof); } extern (C) void main() { int* int_ptr = cast(int*)0x1037; char* char_ptr = cast(char*)0x1037; test_fn(int_ptr); test_fn(char_ptr); } ``` This function

@nogc and Phobos

2023-03-11 Thread bomat via Digitalmars-d-learn
Hi all, I am a C++ programmer in my "day job" and was playing around with D to maybe use it in a personal project. I'm using Dear ImGui for the graphical user interface, for which I use this port: https://github.com/KytoDragon/imgui/ It works fairly well so far, just one problem: Dear ImGui

vibe.d

2023-03-11 Thread seany via Digitalmars-d-learn
Hi I am trying to send an email via vibe .d Here is the code snippet. ``` Mail email = new Mail; email.headers["Date"] = Clock.currTime(PosixTimeZone.getTimeZone("America/New_York")).toRFC822DateTimeString(); // uses UFCS email.headers["Sender"] = "<"; // valid mail email.headers["From"]