Re: bindbc, SDL

2025-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 27 March 2025 at 06:17:28 UTC, Claus D. Volko wrote: Well, well. Now my code builds but it seems that the call of SDL_Init fails. I wonder if SDL3.lib is okay since I built it myself using Visual Studio. Maybe there is some prebuilt version available somewhere? If you are using

Re: Looking for a simple GUI library that works with Vulkan on SDL2

2025-02-19 Thread ryuukk_ via Digitalmars-d-learn
Forgot to mention: nanogui from drug007: https://github.com/drug007/nanogui Fluid from arta: https://forum.dlang.org/thread/wwdqjlrlbzyvodmkt...@forum.dlang.org minigui from adam: https://arsd-official.dpldocs.info/arsd.minigui.html

Re: Looking for a simple GUI library that works with Vulkan on SDL2

2025-02-19 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 19 February 2025 at 15:21:19 UTC, Danny Arends wrote: Hey all, I am looking to integrate a GUI library like IMgui / Nuklear into my app that uses Vulkan within SDL2 for rendering so that it can run on Windows, Linux, and Android (https://github.com/DannyArends/CalderaD). I've

Re: core.simd and dynamic arrays

2025-01-26 Thread ryuukk_ via Digitalmars-d-learn
LDC 1.36 = 1 years old latest version is LDC 1.40 with LDC 1.40, your code works on my computer now my turn to ask a question: why were you using a 1 years old compiler version? common sense would be to make sure you are up to date before wondering why it's broken

Re: ImportC question

2024-10-30 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 30 October 2024 at 15:17:56 UTC, DLearner wrote: On Wednesday, 30 October 2024 at 09:21:55 UTC, ryuukk_ wrote: On Tuesday, 29 October 2024 at 20:26:58 UTC, DLearner wrote: On Tuesday, 29 October 2024 at 18:57:15 UTC, Salih Dincer wrote: On Monday, 28 October 2024 at 20:56:03 UTC,

Re: ImportC question

2024-10-30 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 29 October 2024 at 20:26:58 UTC, DLearner wrote: On Tuesday, 29 October 2024 at 18:57:15 UTC, Salih Dincer wrote: On Monday, 28 October 2024 at 20:56:03 UTC, DLearner wrote: Just trying ImportC under Windows 10: ```c #include int main() { printf("Hello world.\n"); return 0;

Re: ImportC question

2024-10-29 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 29 October 2024 at 15:14:24 UTC, DLearner wrote: On Tuesday, 29 October 2024 at 12:42:49 UTC, Lance Bachmeier wrote: On Tuesday, 29 October 2024 at 12:23:06 UTC, DLearner wrote: However, there is still a problem: ``` dmd hello.c C:\D\dmd2\windows\bin64\..\..\src\druntime\import\imp

Re: NGINX Unit and vibe.d Integration Performance

2024-10-27 Thread ryuukk_ via Digitalmars-d-learn
Let's take a moment to appreciate how easy it was for you to use nginx unit from D https://github.com/kyleingraham/unit-d-hello-world/blob/main/source/unit_integration.c ImportC is great

Re: need help to find a way to replace c macro

2024-10-15 Thread ryuukk_ via Digitalmars-d-learn
Try this great tool by denis korpel https://dkorpel.github.io/ctod/ I've been using it every so often to port C stuff, it's been very helpful ```D @nogc nothrow: extern(C): __gshared: union JSCFunctionType { JSCFunction* generic; JSValue function(JSContext* ctx, JSValueConst this_val,

Re: std.math not installed with WSL (debian) apt install ldc

2024-10-11 Thread ryuukk_ via Digitalmars-d-learn
ldc 1.24 is 4 years old debian stable has: 1.30.0 so sounds like you are using an ancient version of debian, upgrade

Re: Why is this not allowed?

2024-10-08 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 7 October 2024 at 18:06:30 UTC, Steven Schveighoffer wrote: On Sunday, 6 October 2024 at 05:41:10 UTC, ryuukk_ wrote: There is no new syntax to invent instead of writing this error: ``` onlineapp.d(8): Error: no identifier for declarator `stats` ``` you generate a random identifier

Re: Why is this not allowed?

2024-10-08 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 7 October 2024 at 19:34:00 UTC, Sergey wrote: On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote: all other C like languages allow me to be concise Which one btw? Except C++ C#, Go and Zig seems against this functionality.. Don't lie brother go: ```Go package main impo

Re: Why is this not allowed?

2024-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 7 October 2024 at 09:22:20 UTC, Nick Treleaven wrote: On Monday, 7 October 2024 at 08:05:59 UTC, ryuukk_ wrote: I'm working on it TODAY, therefore i need a today's solution ```d import std.typecons; struct EntityDef { Tuple!(int, "hp") stats; } void main() { EntityDef ed;

Re: Why is this not allowed?

2024-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 6 October 2024 at 10:19:55 UTC, Nick Treleaven wrote: On Saturday, 5 October 2024 at 17:26:59 UTC, Steven Schveighoffer wrote: It’s the semicolon. As soon as the closing brace, the declaration is over. You would have to invent new syntax. Maybe type tuple syntax will support this: `

Re: Why is this not allowed?

2024-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 October 2024 at 17:26:59 UTC, Steven Schveighoffer wrote: On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote: Why is this allowed ```D struct EntityDef { struct { int hp; } } ``` But not this fucking thing? ```D struct EntityDef { struct {

Re: Why is this not allowed?

2024-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 October 2024 at 17:41:13 UTC, Sergey wrote: On Saturday, 5 October 2024 at 10:35:30 UTC, ryuukk_ wrote: On Saturday, 5 October 2024 at 06:43:00 UTC, Richard (Rikki) Andrew Cattermole wrote: I don't know why it isn't supported. Its very useful with bindings to C. The parser shou

Re: Why is this not allowed?

2024-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 October 2024 at 16:40:46 UTC, Salih Dincer wrote: On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote: No, i don't want to do: ```C struct EntityDef { struct Stats { int hp; } stats; } ``` Repeating the same name 3 times, i should go back to the ston

Re: Why is this not allowed?

2024-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 October 2024 at 16:40:46 UTC, Salih Dincer wrote: On Saturday, 5 October 2024 at 06:35:57 UTC, ryuukk_ wrote: No, i don't want to do: ```C struct EntityDef { struct Stats { int hp; } stats; } ``` Repeating the same name 3 times, i should go back to the ston

Re: Why is this not allowed?

2024-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 October 2024 at 06:43:00 UTC, Richard (Rikki) Andrew Cattermole wrote: I don't know why it isn't supported. Its very useful with bindings to C. The parser should be able to swap it to a named instance with a generated name. Let's PR and let's merge

Re: assert

2024-09-11 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 11 September 2024 at 09:14:39 UTC, Nick Treleaven wrote: On Wednesday, 11 September 2024 at 08:08:45 UTC, ryuukk_ wrote: It is a bug, don't claim it is not, the compiler gives the wrong information, wich lead to a confused user You don't want confused users, you want compiler say

Re: Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-09-01 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 1 September 2024 at 03:06:53 UTC, Paul Backus wrote: On Saturday, 31 August 2024 at 22:06:26 UTC, kdevel wrote: Is that functionally different from ``` void main() { import std.stdio; int[string] test = ["hello": 42]; if (auto p = "hello" in test) { writeln(

Re: Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-08-31 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 31 August 2024 at 16:34:00 UTC, Lance Bachmeier wrote: On Saturday, 31 August 2024 at 15:38:49 UTC, ryuukk_ wrote: Let's see how other languages do it: ```zig map.put("hello", 42); // get pointer if (map.get("hello")) |*it| { std.log.debug("{}", .{it}); }

Re: Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-08-31 Thread ryuukk_ via Digitalmars-d-learn
Let's see how other languages do it: ```zig map.put("hello", 42); // get pointer if (map.get("hello")) |*it| { std.log.debug("{}", .{it}); } // get value if (map.get("hello")) |it| { std.log.debug("{}", .{it}); } ``` No imports, no templates, ONE LIN

Re: Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-08-31 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 31 August 2024 at 14:25:29 UTC, Paul Backus wrote: On Saturday, 31 August 2024 at 12:47:25 UTC, ryuukk_ wrote: ```D void main() { int[string] test; test["hello"] = 42; if (auto it = "hello" in test) { } } ``` Is there a way to get the value instead of a point

Re: Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-08-31 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 31 August 2024 at 13:00:42 UTC, Steven Schveighoffer wrote: On Saturday, 31 August 2024 at 12:47:25 UTC, ryuukk_ wrote: ```D void main() { int[string] test; test["hello"] = 42; if (auto it = "hello" in test) { } } ``` Is there a way to get the value instead o

Associative Array, get value instead of poiter using `if (auto ..)`, possible?

2024-08-31 Thread ryuukk_ via Digitalmars-d-learn
```D void main() { int[string] test; test["hello"] = 42; if (auto it = "hello" in test) { } } ``` Is there a way to get the value instead of a pointer? while keeping the conciseness (one line)

Re: How do you typically debug / write D code (Visual Studio - known to be broken in Error pane etc), VScode - I get this error...

2024-08-19 Thread ryuukk_ via Digitalmars-d-learn
How do I get LLDB to work? This is why i asked you what OS you use, but you didn't answer Click on the link bellow the screenshot and follow the doc And post log about errors you encounter, otherwise i can't help you, i am not on your PC

Re: How do you typically debug / write D code (Visual Studio - known to be broken in Error pane etc), VScode - I get this error...

2024-08-19 Thread ryuukk_ via Digitalmars-d-learn
What's your OS? Debugging works very nice with vscode: ```json { "name": "game: client", "type": "lldb", "request": "launch", "program": "${workspaceFolder}/bin/game", "cwd": "${workspaceFolder}/bin", }, ``` use: http

Re: Build fully static library by the compiler?

2024-08-11 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 10 August 2024 at 08:07:14 UTC, Denis Feklushkin wrote: On Friday, 9 August 2024 at 22:32:21 UTC, Alex Bryan wrote: Point is that D can be not a main language of the project and it is unconvient to extract by somehow paths to phobos and druntime at last stages of project build.

Re: Build fully static library by the compiler?

2024-08-09 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 9 August 2024 at 22:32:21 UTC, Alex Bryan wrote: On Friday, 9 August 2024 at 02:34:03 UTC, Denis Feklushkin wrote: We can build static library directly from the compiler: $ ldc2 --lib app.d produces app.a file with app.o inside of it. Are there simple way to make a static library t

Re: How to build a statically linked executable, before i loose my mind

2024-07-14 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 14 July 2024 at 06:34:54 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/07/2024 5:06 AM, ryuukk_ wrote: On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/07/2024 4:37 AM, ryuukk_ wrote: On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (R

Re: How to build a statically linked executable, before i loose my mind

2024-07-13 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 13 July 2024 at 16:44:22 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/07/2024 4:37 AM, ryuukk_ wrote: On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) Andrew Cattermole wrote: Seeing ``_d_arraybounds_slice`` missing sounds like druntime isn't being linked against.

Re: How to build a statically linked executable, before i loose my mind

2024-07-13 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 13 July 2024 at 16:16:20 UTC, Richard (Rikki) Andrew Cattermole wrote: Seeing ``_d_arraybounds_slice`` missing sounds like druntime isn't being linked against. It is possible that your distribution of ldc doesn't include a static build of druntime/phobos. You need to verify that l

Re: How to build a statically linked executable, before i loose my mind

2024-07-13 Thread ryuukk_ via Digitalmars-d-learn
For anyone curious: https://github.com/ryuukk/dls/tree/master ``make build-dcd-release && make build-dls-release`` i'm giving up for now, i'll never touch druntime/phobos/dub never again

Re: How to build a statically linked executable, before i loose my mind

2024-07-13 Thread ryuukk_ via Digitalmars-d-learn
I'm loosing it Even with dub it doesn't work `"lflags": [ "-static", "--link-defaultlib-shared=false" ],` ``` (cut due to forum's limit) trivia.d:(.text._D6dparse6trivia__T22MultiLineCommentHelperHTyaZQBd6__ctorMFNaNbNcNfAyaZSQCtQCp__TQClHTyaZQCt+0x1a9): undefined reference to `_d_arraybound

Re: Why does this mixin fail to compile?

2024-07-06 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 3 July 2024 at 03:52:41 UTC, Steven Schveighoffer wrote: On Tuesday, 2 July 2024 at 07:23:42 UTC, ryuukk_ wrote: I said it 2 times already, i don't want string concatenation, i'll benchmark later, but not right now, right now i'm looking for a functioning code without string conc

Re: Why does this mixin fail to compile?

2024-07-02 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 1 July 2024 at 21:43:02 UTC, Dennis wrote: On Monday, 1 July 2024 at 13:00:55 UTC, ryuukk_ wrote: please stick to what i wrote, i don't want string concatenation, i provide a reduced example from my project, everything should be a single template block, no extra functions other than

Re: Why does this mixin fail to compile?

2024-07-01 Thread ryuukk_ via Digitalmars-d-learn
Ok, i'll just do it and benchmark at the end Another question: Why doesn't this work?: ```D mixin implement; mixin template implement() { char[4096] buffer = 0; int pos = 0; void append(string str) { buffer[pos .. pos + str.length] = str[]; pos += str.length;

Re: Why does this mixin fail to compile?

2024-07-01 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 1 July 2024 at 10:20:25 UTC, drug007 wrote: On 01.07.2024 12:39, ryuukk_ wrote: On Monday, 1 July 2024 at 09:29:50 UTC, Dennis wrote: On Monday, 1 July 2024 at 09:25:39 UTC, ryuukk_ wrote: This simple mixin fails to compile, anyone know why? ```D mixin implement; mixin template im

Re: Why does this mixin fail to compile?

2024-07-01 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 1 July 2024 at 09:29:50 UTC, Dennis wrote: On Monday, 1 July 2024 at 09:25:39 UTC, ryuukk_ wrote: This simple mixin fails to compile, anyone know why? ```D mixin implement; mixin template implement() { mixin("struct _gen(T) {"); mixin("}"); } A string mixin must form a com

Why does this mixin fail to compile?

2024-07-01 Thread ryuukk_ via Digitalmars-d-learn
This simple mixin fails to compile, anyone know why? ```D mixin implement; mixin template implement() { mixin("struct _gen(T) {"); mixin("}"); } void main(){} ``` ``` onlineapp.d-mixin-5(5): Error: `}` expected following members in `struct` declaration onlineapp.d-mixin-5(5):

Re: Why is this happening to my software? An illegal instruction error.

2024-06-19 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 18 June 2024 at 23:07:47 UTC, Murilo wrote: I've created a software which performs the Fermat's Primality Test, however if I input a very big number it causes an error saying "Illegal instruction (core dumped)". Does anyone know why? I've used GDB and here is the message: Program

Re: Missing library dependencies compiling app with importC

2024-02-23 Thread ryuukk_ via Digitalmars-d-learn
Wich version of visual studio you have? From what i could find online, it could be due to having an older version, try to update it if it's too old

Re: LDC Stacktrace with symbols instead of addresses

2024-02-12 Thread ryuukk_ via Digitalmars-d-learn
I agree, debug builds should show proper stack trace by default You should submit a PR for dmd and call what ever is that function behind a `debug` block when it hooks the C main function As for LDC, it's weird that it doesn't work, they should share the same runtime no?

Re: How to unpack a tuple into multiple variables?

2024-02-07 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 7 February 2024 at 05:29:45 UTC, Gary Chike wrote: On Wednesday, 7 February 2024 at 01:17:33 UTC, zjh wrote: Officially, there should be an unpacking solution, like ```d //C++ auto[a,b,c]=tuple. ``` Wouldn't that be nice? I hope a clean and terse direct-implementation comes in

Re: Why is the following failing?

2024-01-25 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 25 January 2024 at 17:50:57 UTC, Johan wrote: On Thursday, 25 January 2024 at 16:07:44 UTC, Stefan Koch wrote: On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote: ```D void main() { char[32] id = 0; id = "hello"; } ``` this works fine, and that is what i expect f

Re: Why is the following failing?

2024-01-25 Thread ryuukk_ via Digitalmars-d-learn
```D void main() { char[32] id = 0; id = "hello"; } ``` this works fine, and that is what i expect for the example above..

Re: Why is the following failing?

2024-01-25 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 25 January 2024 at 15:22:35 UTC, Hipreme wrote: On Thursday, 25 January 2024 at 15:20:01 UTC, ryuukk_ wrote: ```D void main() { char[32] id = 0; const(char)* str = "hello"; id = str[0 .. 6]; } ``` it should be a simple memcpy, why DMD complain? ``onlineapp.d(6): Err

Why is the following failing?

2024-01-25 Thread ryuukk_ via Digitalmars-d-learn
```D void main() { char[32] id = 0; const(char)* str = "hello"; id = str[0 .. 6]; } ``` it should be a simple memcpy, why DMD complain? ``onlineapp.d(6): Error: mismatched array lengths 32 and 6 for assignment `id[] = str[0..6]``` I'm too tired to notice something obvious?

Re: opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 17:22:25 UTC, Paul Backus wrote: On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote: It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onlineapp.d(13): Error: cannot uniquely infer `foreach` argument types ``` I h

Re: opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 23 January 2024 at 17:07:18 UTC, Alexandru Ermicioi wrote: On Tuesday, 23 January 2024 at 16:11:25 UTC, ryuukk_ wrote: Hello, I have the following: ```D struct Stuff { int opApply(scope int delegate(Stuff*) dg) { return 0; } }; void main() { Stuff* stuff;

opApply + const

2024-01-23 Thread ryuukk_ via Digitalmars-d-learn
Hello, I have the following: ```D struct Stuff { int opApply(scope int delegate(Stuff*) dg) { return 0; } }; void main() { Stuff* stuff; foreach(it; *stuff) {} } ``` It works fine.. but when the variable becomes ``const(Stuff)* stuff;`` It gives me: ``` onl

Re: std.sumtype nested SumTypes

2024-01-22 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 22 January 2024 at 16:16:56 UTC, NonNull wrote: I am defining a new value type (small struct) from some old value types that are already `SumType`s. So I want to have some `SumType`s as some of the alternative types in another `SumType`. How how efficient this is, including space

Re: Setting field of struct object

2024-01-22 Thread ryuukk_ via Digitalmars-d-learn
I should note that it only took me 1 project to never want to touch C++ again.. that must be telling something, either about the language, or me, or both lol

Re: Setting field of struct object

2024-01-22 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 22 January 2024 at 11:31:11 UTC, zjh wrote: On Monday, 22 January 2024 at 08:54:54 UTC, zjh wrote: ```d struct Person { string name, email; ulong age; } Person a{"n","email",33}; ``` C++ can achieve ultimate `simplicity` without violating `DRY`, And here, D violates the `D

Re: macOS Sonoma Linker Issue

2024-01-20 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 20 January 2024 at 20:35:16 UTC, Renato wrote: On Friday, 22 December 2023 at 17:50:47 UTC, Johan wrote: Some general advice: 1 - use `dub` from LDC's package (this may solve some arm64 vs x86 issues when on Apple Silicon CPU) 2 - when you use a new or different compiler, you have

Re: Delegates and values captured inside loops

2024-01-20 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 20 January 2024 at 15:59:59 UTC, Anonymouse wrote: I remember reading this was an issue and now I ran into it myself. ```d import std.stdio; void main() { auto names = [ "foo", "bar", "baz" ]; void delegate()[] dgs; foreach (name; names) { dgs ~= () => wri

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-19 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 19 January 2024 at 17:18:36 UTC, evilrat wrote: On Friday, 19 January 2024 at 16:55:25 UTC, ryuukk_ wrote: You do hash map lookup for every character in D, it's slow, whereas in Rust you do it via pattern matching, java does the same, pattern matching Yet another reason to advoc

Re: Help optimize D solution to phone encoding problem: extremely slow performace.

2024-01-19 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 19 January 2024 at 13:40:39 UTC, Renato wrote: On Friday, 19 January 2024 at 10:15:57 UTC, evilrat wrote: On Friday, 19 January 2024 at 09:08:17 UTC, Renato wrote: I forgot to mention: the Java version is using a Trie... and it consistently beats the Rust numeric algorithm (which m

Re: How to use ImportC to import WebGPU header

2024-01-11 Thread ryuukk_ via Digitalmars-d-learn
You need to use a .c file that include it --- webgpu.c ```c #include "webgpu.h" ``` --- app.d ```d import std.stdio; import webgpu; void main() { writeln(WGPUBlendFactor_Dst); } ``` result: ``` $ dmd -run app.d webgpu.c WGPUBlendFactor_Dst ```

Re: sokol-d: Static Struct

2024-01-03 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 3 January 2024 at 17:50:19 UTC, Matheus Catarino wrote: On Saturday, 30 December 2023 at 20:20:50 UTC, ryuukk_ wrote: I suspect you have a typo in one of your definition I debugged some existing bindings, and despite any user-level errors (via code) there's some conflict between

Re: Web APis

2023-12-31 Thread ryuukk_ via Digitalmars-d-learn
nvm, that's not what you are asking for

Re: Web APis

2023-12-31 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 31 December 2023 at 04:40:02 UTC, Axel Casillas wrote: Hi there, I'm trying to implement web api's into a terminal program. With some help at the IRC have gotten pretty far but just hit a roadblock trying to manipulate the web api to accept input from the user. Example: auto con

Re: sokol-d: Static Struct

2023-12-30 Thread ryuukk_ via Digitalmars-d-learn
Use https://renderdoc.org/ and check and compare frames for both your working and non-working example That'll give you an idea at what could be wrong I suspect you have a typo in one of your definition I'll try to take a look later

Re: surviving wasm

2023-12-14 Thread ryuukk_ via Digitalmars-d-learn
I forgot to link this nice website that got me started with WASM: https://schellcode.github.io/webassembly-without-emscripten

Re: surviving wasm

2023-12-14 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 13 December 2023 at 20:40:20 UTC, monkyyy wrote: so long term planning on wasm raylib; I want compatibility with the good parts of the std, the std is causal about using libc while ldc-wasm half-baked implication is missing a bunch of basically worthless symbols but given the std

Re: Request help on allocator.

2023-12-02 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 2 December 2023 at 19:13:18 UTC, Vino B wrote: Hi All, Request your help in understanding the below program, with the below program I can allocate 8589934592(8GB) it prints the length 8589934592(8GB) where as my laptop has only 4 GB so the confusion is that how can this program

Re: Inversion of conditional compilation statements

2023-12-02 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 2 December 2023 at 15:48:02 UTC, Nick Treleaven wrote: On Saturday, 2 December 2023 at 15:03:25 UTC, ryuukk_ wrote: I wish we could use ``version`` as expression, to void the repetition: ```D import std.stdio; enum HasTest = version (Test) ? true : false; Tomek Sowiński wrote t

Re: Inversion of conditional compilation statements

2023-12-02 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 2 December 2023 at 13:16:26 UTC, Johannes Miesenhardt wrote: Hello, I am trying to learn D and I have stumbled upon an issue Consider this code: ```d import std.stdio; //version = Test; int main() { version (Test) { writeln("Hello, world!"); }

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Here is how adam seems to be doing it: https://github.com/adamdruppe/webassembly/blob/731a7033174127c0a6dd4f23eabdb440adab286b/arsd-webassembly/object.d#L650-L681 Specially here: ```D void destroy(bool initialize = true, T)(T obj) if (is(T == class)) { (..) else { // Bypass over

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Please tag your code accordingly, as is it's unreadable ```D // your code here ``` (tick the "Enable Markdown" too, next to the Send button)

Re: Dlang installer with VSCode broken

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Looks like his vscode is outdated, make sure your friend has the latest version installed

Re: win32 api & lib issue

2023-11-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UT

Re: Symbolic computations in D

2023-10-29 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 29 October 2023 at 08:55:24 UTC, Dmitry Ponyatov wrote: Yesterday some student asked me about ability to make some dumb symbolic computation in C++ the same like way as it looks in the MathCAD or Maxima CAS, but run it compiled on a robot platform in realtime. I have no idea about

Re: Can't get into debugger in vscode on macOS

2023-10-19 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 19 October 2023 at 06:03:06 UTC, Daniel Zuncke wrote: Hello, I need some help getting into the debugger in vscode on macOS. It did work some months ago but that was finicky to set up. Maybe I am forgetting something now? I am compiling the project with `dub build --build debug --

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to _My_struct_

Re: is the array literal in a loop stack or heap allocated?

2023-10-10 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 11 October 2023 at 02:54:53 UTC, mw wrote: Hi, I want to confirm: in the following loop, is the array literal `a` vs. `b` stack or heap allocated? and how many times? void main() { int[2] a; int[] b; int i; While(++i <=100) { a = [i, i+1]; // array literal b = [i, i+1];

Re: how to assign multiple variables at once by unpacking array?

2023-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 7 October 2023 at 17:23:40 UTC, ryuukk_ wrote: On Saturday, 7 October 2023 at 07:31:45 UTC, mw wrote: https://stackoverflow.com/questions/47046850/is-there-any-way-to-assign-multiple-variable-at-once-with-dlang How to do this Python code in D: ``` s = "1 2 3" A,B,C = map(int, s.s

Re: how to assign multiple variables at once by unpacking array?

2023-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 7 October 2023 at 07:31:45 UTC, mw wrote: https://stackoverflow.com/questions/47046850/is-there-any-way-to-assign-multiple-variable-at-once-with-dlang How to do this Python code in D: ``` s = "1 2 3" A,B,C = map(int, s.split(" ")) A,B,C (1, 2, 3) ``` Is there a better way (sinc

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 15:12:34 UTC, Joel wrote: The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? ```d // Adding program - literal functions import std; struct List(T) { class Node

Re: Type constraint

2023-10-03 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 11:43:46 UTC, Joel wrote: I’ve got a struct that has a method that adds numbers together. I want to do something like this, static if (isInteger!T) … but it isn’t working. static if (is(T==int)) works for one integer type. ```d struct List(T) { auto addUp()

Re: Is it possible to create a kernel for an operating system in D?

2023-09-27 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 26 September 2023 at 03:31:36 UTC, I come from chill. wrote: It seems very obvious, but I have not been able to find any information on the subject to confirm this. So I'm wondering if it's possible. ** Maybe I shouldn't have created the account, literally this will be one of the

Re: C to D: please help translate this weird macro

2023-09-20 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D [here](https://

Re: Setting struct as default parameter of a function using struct literal?

2023-09-11 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 11 September 2023 at 17:51:04 UTC, BoQsc wrote: https://docarchives.dlang.io/v2.073.0/spec/struct.html#struct-literal I would like to set function's default struct for a function in a way that it would be visible for the reader to see what options are set. Something like `Options op

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-10 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 8 September 2023 at 13:34:42 UTC, Richard (Rikki) Andrew Cattermole wrote: In case you didn't know, all you need to get unittests working in -betterC is: ```d foreach (module_; allModules) { foreach (unitTest; __traits(getUnitTe

Re: I don't understand betterC

2023-09-01 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 1 September 2023 at 13:17:08 UTC, confused wrote: On Friday, 1 September 2023 at 08:19:55 UTC, Richard (Rikki) Andrew Cattermole wrote: ``size_t`` is defined in ``object.d`` which is implicitly imported into all modules. If it cannot be found, one of three things is happening: 1) Y

Re: toLower

2023-08-15 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 16:47:36 UTC, Joel wrote: How come toLower works in the sort quotes, but not in the map? ```d void main() { import std; "EzraTezla" .to!(char[]) .byCodeUnit .sort!"a.toLower c.toLower) .writeln; } ``` onlineapp.d(60): Error:

Re: Test post - please ignore

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 17:27:00 UTC, Cecil Ward wrote: I have been getting error messages when I try to post to the forum. This is just a test, so please ignore. There was some issues with the forums last week, it seems all resolved now https://forum.dlang.org/thread/uar9k5$1kei$1...@d

Re: std.experimental.allocator

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 16:00:51 UTC, Richard (Rikki) Andrew Cattermole wrote: Yeah you're right Ternary should probably be replaced, although amazingly it has never caused problems so far. But I cannot agree about RAII. Its a valid tool for managing lifetimes of memory allocators. Memory

Re: stb library and importC

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 15:39:19 UTC, Richard (Rikki) Andrew Cattermole wrote: On 14/08/2023 3:23 AM, ryuukk_ wrote: On Sunday, 13 August 2023 at 06:43:10 UTC, Richard (Rikki) Andrew Cattermole wrote: I would argue that this should be done by dmd as it knows where the VS installation is an

Re: std.experimental.allocator

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 15:25:16 UTC, Richard (Rikki) Andrew Cattermole wrote: Mine (-betterC) https://github.com/Project-Sidero/basic_memory/tree/main/source/sidero/base/allocators Similar scope to one in Phobos. On that note I'm still waiting a year+ for Atila to get back to me about t

Re: stb library and importC

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 06:43:10 UTC, Richard (Rikki) Andrew Cattermole wrote: I would argue that this should be done by dmd as it knows where the VS installation is and it'll catch people out who aren't using dub. Oh better, let's try to send a PR to dmd then for today, it shouldn't be

Re: std.experimental.allocator

2023-08-13 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 13 August 2023 at 11:44:50 UTC, IchorDev wrote: I feel like I can't possibly be the first to ask, but I couldn't find any prior discussion of this: When is `std.experimental.allocator` going to be moved out of `experimental`? Is there any roadmap for it? Is it just in limbo? We can

Re: How to create an .exe without execute the terminal in Windows?

2023-08-12 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 12 August 2023 at 23:22:20 UTC, thePengüin wrote: On Saturday, 12 August 2023 at 23:18:16 UTC, Adam D Ruppe wrote: On Saturday, 12 August 2023 at 23:13:39 UTC, thePengüin wrote: I would know how to make some this but in Dlang: best way is to use the linker switch. On Win32,

Re: how to make pragma(lib)'s path relative to the package's path?

2023-08-01 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 31 July 2023 at 08:58:43 UTC, Johan wrote: On Monday, 31 July 2023 at 00:32:07 UTC, ryuukk_ wrote: I reworked the PR, here is the new link: https://github.com/dlang/dmd/pull/15479 It basically add support for ``pragma(lib, "local:bin/lib.a");`` Makes things easier, and doesn't ch

Re: Anyone help me with a stack dump?

2023-07-31 Thread ryuukk_ via Digitalmars-d-learn
Your problem lies at line 1541 You can use `ddemangle` executable to make mangled names readable, i don't know if it comes with the compiler ``` _platform_memmove pure nothrow ref @trusted wchar[] core.internal.array.appending._d_arrayappendT!(wchar[], char)._d_arrayappendT(scope return ref

Re: how to make pragma(lib)'s path relative to the package's path?

2023-07-30 Thread ryuukk_ via Digitalmars-d-learn
I reworked the PR, here is the new link: https://github.com/dlang/dmd/pull/15479 It basically add support for ``pragma(lib, "local:bin/lib.a");`` Makes things easier, and doesn't change any old behavior

Re: how to make pragma(lib)'s path relative to the package's path?

2023-07-30 Thread ryuukk_ via Digitalmars-d-learn
I offered a workaround to this problem as a PR, if everyone is interested in providing feedback, here is the link: https://github.com/dlang/dmd/pull/15478

Re: Is there any place where i can check current status and plans for -preview flags?

2023-07-30 Thread ryuukk_ via Digitalmars-d-learn
I'm interesting in that as well, i use ``-preview=rvaluerefparam`` in all of my projects, i can't live without it, i would love to know about its state and if it'll be merged as a official feature (hopefully not removed lol), i'm in the process of simpifying all of my builds scripts right now,

Re: pragma lib doesn't support static libraries?

2023-07-30 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 30 July 2023 at 15:40:08 UTC, Adam D Ruppe wrote: On Sunday, 30 July 2023 at 05:53:55 UTC, Mike Parker wrote: And I'm unaware of any mechanism for embedding static library names in an object file for a linker to read later. There is a mechanism on Windows, so it tends to work there,

  1   2   3   >