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

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 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

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
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-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-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: 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: 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
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
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-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: 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: 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: 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: 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: 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-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
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 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: 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: 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: UI Library

2022-05-20 Thread ryuukk_ via Digitalmars-d-learn
Avoid GTK, it's bloated, GTK4 looks like a toolkit to design mobile apps, and you need runtime dependencies on windows adam's gui library is very nice, 0 dependencies I personally prefer IMGUI, 0 dependencies, you bring the windowing library of your choice, i pick GLFW since it's minimal IMG

ImportC: unresolved external symbol

2022-06-14 Thread ryuukk_ via Digitalmars-d-learn
Hello Tried to give ImportC a try to finally get rid of gluecode in one of my project, but this simple test gives me a compile error: nk.c ``` int test(void) { return 1; } ``` app.d ``` import std.stdio; import nk = nk; void main() { if (nk.test() != 0) { writeln("te

Re: ImportC: unresolved external symbol

2022-06-14 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 14:38:17 UTC, Mike Parker wrote: On Tuesday, 14 June 2022 at 14:32:50 UTC, ryuukk_ wrote: ``` nk.obj : error LNK2019: unresolved external symbol test referenced in function _Dmain ``` Am i missing something important? (that is a dub project, created with: dub in

Re: How to call a function from a dll created with d ?

2022-07-01 Thread ryuukk_ via Digitalmars-d-learn
I think it is `extern(D) void testFunc();`?

Unwrap variadic template into vararg of pointers of the same types

2022-07-08 Thread ryuukk_ via Digitalmars-d-learn
I'm not sure how to phrase it so it'll try with code I have this piece of code that i would like to improve, right now i have to create bunch of duplicates ```D void view_it(A, B)(void function(entity_t, A*, B*) cb) { foreach(it, e; view!(Includes!(A, B))) {

Re: vectorization of a simple loop -- not in DMD?

2022-07-11 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 11 July 2022 at 21:46:10 UTC, IGotD- wrote: On Monday, 11 July 2022 at 18:19:41 UTC, max haughton wrote: The dmd backend is ancient, it isn't really capable of these kinds of loop optimizations. I've said it several times before. Just depreciate the the DMD backend, it's just not

Re: Unwrap variadic template into vararg of pointers of the same types

2022-07-11 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 8 July 2022 at 12:48:20 UTC, Paul Backus wrote: On Friday, 8 July 2022 at 12:20:13 UTC, ryuukk_ wrote: The problem when i try to introduce variadic template, is i can't seem to understand how to unwrap the parameter as pointer type T -> T* ```D struct Includes(Args...) { alias arg

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 12 July 2022 at 09:18:02 UTC, Siarhei Siamashka wrote: On Tuesday, 12 July 2022 at 07:58:44 UTC, bauss wrote: You don't think this difference is huge? DMD is over 2x as fast. I think that DMD having more than 10x faster compilation speed in ryuukk_'s project shows that there is li

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread ryuukk_ via Digitalmars-d-learn
How do i achieve fast compile speed (results above were on windows, on linux i get much faster results): I maintain healthy project management: - Templates ONLY when necessary and when the cost is worth the time saved in the long term - this is why i try to lobby for builtin tagged union ins

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 12 July 2022 at 12:47:26 UTC, bauss wrote: Of course if you're alone it doesn't matter, but if it's a larger project that will have multiple maintainers then it will never work and will tarnish the project entirely. That's true, i work solo on my project so it doesn't bother me It

Re: vectorization of a simple loop -- not in DMD?

2022-07-14 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 14 July 2022 at 05:30:58 UTC, Siarhei Siamashka wrote: On Tuesday, 12 July 2022 at 13:23:36 UTC, ryuukk_ wrote: I wonder if DMD/LDC/GDC have built in tools to profile and track performance Linux has a decent system wide profiler: https://perf.wiki.kernel.org/index.php/Main_Page A

Re: "Memory allocation failed" on big array

2022-07-20 Thread ryuukk_ via Digitalmars-d-learn
My guess is you are compiling to 32bit and the GC tries to reserve >4gb wich it can't, therefore out of memory Compiling to 64bit with: `dmd -m64 -run test.d` works no problem

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
I don't know what `writefln` is doing, but this following D code is the exact similar to your C code ``` import core.stdc.stdio; void main() { const(char)[] ch = "Hello World!"; const(char)* p; p = &ch[0]; p++; printf("%s", p); } ``` `ello World!`

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
Here is the way to do it with `writefln` (i think) ```D import std; import core.stdc.string; void main() { const(char)[] ch = "Hello World!"; const(char)[] ch2 = "abc"; const(char)* p; p = &ch[0]; p++; auto str = p[0 .. strlen(p)]; writefln("%s", str); } ``

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 25 July 2022 at 11:14:56 UTC, pascal111 wrote: On Monday, 25 July 2022 at 09:36:05 UTC, ryuukk_ wrote: Here is the way to do it with `writefln` (i think) ```D import std; import core.stdc.string; void main() { const(char)[] ch = "Hello World!"; const(char)[] ch2 = "abc";

Re: Some user-made C functions and their D equivalents

2022-07-27 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote: I made a library of some useful functions while I was studying C, and I'm curious to know if D has equivalents or some ones for some of my functions, or I have to retype 'em again in D. The library link: https://github.com/pascal111-

Re: Some user-made C functions and their D equivalents

2022-07-27 Thread ryuukk_ via Digitalmars-d-learn
I don't remember the exact syntax for GDC, but it should be pretty similar to DMD You need to pass the module to the compiler gdc main.d dcollect.d

Re: A converting problem in using "among" with arrays

2022-07-29 Thread ryuukk_ via Digitalmars-d-learn
FYI, you can use the markdown code tag so your code is properly rendered when viewed from the forums (make sure to tick the "Enable Markdown", right next to Send) ``` ```D void my_function() { } ``` ``` it'll be rendered like this: ```D void my_function() { } ```

Re: Request assistance resolving linker error: Undefined symbol(s) for architecture x86_64

2022-08-03 Thread ryuukk_ via Digitalmars-d-learn
Does adding ```-m64``` work

Code compiles and run fine with LDC but segfault with DMD

2022-08-29 Thread ryuukk_ via Digitalmars-d-learn
The following code compiles and run fine with LDC, but with DMD it compiles and then default at runtime ```D -- app.d enum Test {A, B, C} Test test = Test.A; extern(C) void main() { switch(test) { default: break; } } ``` ``` -- object.d // empty for now ``` `dm

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-29 Thread ryuukk_ via Digitalmars-d-learn
I forgot to add: this is on Windows, the problem doesn't exist with linux I reported a bug here: https://issues.dlang.org/show_bug.cgi?id=23310

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-30 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 30 August 2022 at 11:24:21 UTC, wjoe wrote: On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote: What `-g` does that makes this code compile and work with DMD? This flag adds symbolic debug info. But I'm confident you knew that already. You didn't understand the question

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-30 Thread ryuukk_ via Digitalmars-d-learn
Problem fixed, i had to copy bunch of other code from druntime Here is a working object.d: https://gist.github.com/ryuukk/53c133f29da5a8326c359a6bb1063207

Is `void` the correct way to say "do not initialize this variable"?

2022-10-02 Thread ryuukk_ via Digitalmars-d-learn
I have tried to look at the documentation and various places on the DMD source, but i couldn't find the answer ```D MyStruct test = void; ``` Does this guarantee that the compiler will not initialize it? Does it work with static arrays of struct too? The generated code is different than ``MyS

Re: Is `void` the correct way to say "do not initialize this variable"?

2022-10-02 Thread ryuukk_ via Digitalmars-d-learn
I got the answer thanks to IRC chat: https://dlang.org/spec/declaration.html#void_init

Re: Catching C errors

2022-10-19 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 16:47:49 UTC, data pulverizer wrote: On Wednesday, 19 October 2022 at 14:05:35 UTC, data pulverizer wrote: Hi all, I am calling code from a C API, and would like to know how to catch exit errors so that they can be handled and make them more like an exceptions

Re: Find out what type my class is being converted to for comparisons

2022-10-19 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 18:53:41 UTC, Matthew Rushworth wrote: I am in the process of building a matrix class (uni project, with my choice of programming language) and appear to have run into a problem that I'm not too sure how to fix. My class uses templates to define the shape of the

Re: How to pass noncopyable variadic arguments with ref?

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 20 October 2022 at 14:03:10 UTC, tchaloupka wrote: Hi, I've found strange behavior where: ```D import std.stdio; struct Foo { @disable this(this); int x; } void test(Foo[] foos...) { foreach (ref f; foos) { writeln(&f, ": ", f.x); f.x = 0; } } void

Re: [Help Needed] - Debugging compilation time

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
I tried your project: Linux x64 ``` git clone https://github.com/MrcSnm/HipremeEngine.git cd HipremeEngine dub build (once to download dependencies if any) time dub build -f real0m4.604s user0m3.686s sys 0m0.900s ``` 4.6 sec for a FULL rebuild doesn't seem that bad and ``` real

Re: [Help Needed] - Debugging compilation time

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
Make sure you have the latest version of DMD Make sure your antivirus isn't blocking your files (scanning), it's a common thing with Windows, whitelist dmd folder, your dev folder and dub folder

Re: [Help Needed] - Debugging compilation time

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 12:27:21 UTC, Hipreme wrote: On Friday, 21 October 2022 at 18:10:39 UTC, ryuukk_ wrote: I tried your project: Linux x64 ``` git clone https://github.com/MrcSnm/HipremeEngine.git cd HipremeEngine dub build (once to download dependencies if any) time dub build -f

Re: is dmd a virus?

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 07:40:39 UTC, MGW wrote: is dmd a virus? https://www.virustotal.com report: Cybereason --> Malicious.779f29 VBA32 --> BScope.Trojan.DShell It's obviously not We need to contact these companies and let them know about the false positive Someone who has an e

Re: How to use dub with ldc

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 18:08:51 UTC, tobi wrote: Hi, I'm new to D and I would like to get the dlang-tour onto my local machine. As far as I know, on my Pinebook Pro using aarm64 architecture, I must use the LDC compiler. The dlang-tour readme says to run `dub run dlang-tour -- --lang

Re: Disabling All Inlining in DMD Debug Builds

2022-10-24 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote: I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing oper

Re: Disabling All Inlining in DMD Debug Builds

2022-10-25 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote: On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote: I wish we could do ``version(DebugFast | Release)`` Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to

Re: dub ldc2 static linking

2022-10-27 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 28 October 2022 at 01:35:04 UTC, kinke wrote: For fully static linking on Linux, you'll need to move away from glibc to e.g. the musl C runtime, as used by the Alpine distro. I'm just right now having an issue with glibc version mismatch for my server, so i'm looking to move to mus

Re: dub ldc2 static linking

2022-10-27 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 28 October 2022 at 02:46:42 UTC, ryuukk_ wrote: On Friday, 28 October 2022 at 01:35:04 UTC, kinke wrote: For fully static linking on Linux, you'll need to move away from glibc to e.g. the musl C runtime, as used by the Alpine distro. I'm just right now having an issue with glibc ve

Re: Can't seem to find the relevant documentation for dub.

2022-10-31 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 31 October 2022 at 20:20:49 UTC, WhatMeWorry wrote: I've got a pretty straightforward SDL dub file dependency "bindbc-opengl"version="~>1.0.3" versions "GL_46" dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW_33" dependency "gl3n" version="~>1.4.1" depende

Re: A strange DMD error

2022-11-01 Thread ryuukk_ via Digitalmars-d-learn
This reminds me of an issue i reported last year... https://issues.dlang.org/show_bug.cgi?id=22583

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-04 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote: Package.d is a real problem existing on our currently modules design. First is that it means to take the directory name to use as a module. This is a problem for 3 reasons: 1. You won't be able to find your module by the file name. Th

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 November 2022 at 10:18:33 UTC, Hipreme wrote: On Saturday, 5 November 2022 at 01:34:04 UTC, ryuukk_ wrote: On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote: Package.d is a real problem existing on our currently modules design. First is that it means to take the directory

Re: Linking not working properly Windows 11

2022-11-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 November 2022 at 13:30:43 UTC, bauss wrote: Fresh install of DMD and when trying to use ex. std.file from Phobos I get the following linking error: (I can trigger different ones depending on modules imported etc.) ``` lld-link: error: undefined symbol: tzset ``` I assume it has

Re: Linking not working properly Windows 11

2022-11-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 November 2022 at 19:19:09 UTC, bauss wrote: On Saturday, 5 November 2022 at 14:54:52 UTC, Hipreme wrote: On Saturday, 5 November 2022 at 14:14:16 UTC, bauss wrote: On Saturday, 5 November 2022 at 13:42:08 UTC, rikki cattermole wrote: Try ldc, if that works then its just a missing

Re: Is defining get/set methods for every field overkill?

2022-11-23 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 17 November 2022 at 04:39:35 UTC, thebluepandabear wrote: I am creating a TUI library and I have a class with the following constant fields: ``` class Label : Renderable { const string text; const TextAlignment textAlignment; const Color color; this(Dimensions dime

Re: raylib-d Gamepad Detection Fails

2022-11-30 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 22:46:52 UTC, jwatson-CO-edu wrote: Hello, I have this small [gamepad input test program](https://github.com/jwatson-CO-edu/nanoverse/blob/main/d/raylib/04_jsInput/source/app.d). In the program, I poll the first 3 gamepad IDs, but all detection attempts return

Re: raylib-d Gamepad Detection Fails

2022-12-01 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 1 December 2022 at 01:49:09 UTC, jwatson-CO-edu wrote: On Thursday, 1 December 2022 at 01:12:17 UTC, Steven Schveighoffer wrote: On 11/30/22 7:28 PM, jwatson-CO-edu wrote: On Wednesday, 30 November 2022 at 23:18:33 UTC, ryuukk_ wrote: On Wednesday, 30 November 2022 at 22:46:52 UTC,

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: Dear dlang community. I am unsure about what idiomatic D is. Some of the Dconf talks tells people just to use the GC, until you can't afford it. If there are documents that describes what idiomatic D is then I would appreciate it.

Re: LSP-server for D?

2022-12-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 5 December 2022 at 18:36:08 UTC, Per Nordlöw wrote: On Monday, 5 December 2022 at 12:38:07 UTC, Per Nordlöw wrote: On Monday, 5 December 2022 at 12:23:24 UTC, Per Nordlöw wrote: Is there a D lsp-server available? I couldn't find anything at https://code.dlang.org/search?q=lsp. Am I n

Re: printf, writeln, writefln

2022-12-06 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 6 December 2022 at 23:41:09 UTC, H. S. Teoh wrote: On Tue, Dec 06, 2022 at 11:07:32PM +, johannes via Digitalmars-d-learn wrote: //-- the result should be f.i. "the sun is shining" //-- sqlite3_column_text returns a constant char* a \0 delimited c-string printf("%s\n",sqlite3_c

Re: printf, writeln, writefln

2022-12-06 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 7 December 2022 at 01:46:21 UTC, Siarhei Siamashka wrote: On Tuesday, 6 December 2022 at 23:07:32 UTC, johannes wrote: //-- the result should be f.i. "the sun is shining" //-- sqlite3_column_text returns a constant char* a \0 delimited c-string printf("%s\n",sqlite3_column_text(r

Re: Is there such concept of a list in D?

2022-12-11 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 10 December 2022 at 05:46:26 UTC, thebluepandabear wrote: In most languages there is some sort of `List` type, is that the same for D? There is: https://dlang.org/phobos/std_container_dlist.html Why is it called ``DList`` and not just ``List``, i have no clue

Re: Why can't rvalues be passed to a 'ref' parameter?

2022-12-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 11 December 2022 at 04:36:45 UTC, thebluepandabear wrote: Hello, I am not really understanding why rvalues cannot be passed to a 'ref' parameter, the explanation in the book about D I am reading was not clear: "The main reason for this limitation is the fact that a function takin

Re: Is there such concept of a list in D?

2022-12-13 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 12 December 2022 at 07:57:28 UTC, TTK Ciar wrote: On Sunday, 11 December 2022 at 17:45:20 UTC, ryuukk_ wrote: Why is it called ``DList`` and not just ``List``, i have no clue Probably because it is a *D*ouble-linked List :-) oh right, thanks, i never used that module before i sh

Re: How to use version in dub?

2022-12-13 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 13 December 2022 at 20:01:40 UTC, torhu wrote: On Tuesday, 13 December 2022 at 19:50:15 UTC, torhu wrote: On Tuesday, 13 December 2022 at 19:28:44 UTC, Leonardo A wrote: Hello. How to use version in dub? https://dlang.org/spec/version.html "The version level and version identifier

Re: BetterC unexpected results

2023-01-08 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 8 January 2023 at 13:49:22 UTC, DLearner wrote: I thought dynamic arrays were unavailable under -betterC. Example_02: ``` extern(C) void main() { import core.stdc.stdio : printf; int[] A; printf("Hello betterC\n"); } ``` ``` dmd -betterC -run Example_02 ``` Expected result:

Re: Problem with ImportC example?

2023-01-17 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 17 January 2023 at 17:12:49 UTC, DLearner wrote: On Tuesday, 17 January 2023 at 15:55:40 UTC, bachmeier wrote: On Tuesday, 17 January 2023 at 13:21:37 UTC, DLearner wrote: On Tuesday, 17 January 2023 at 11:21:08 UTC, Dennis wrote: On Tuesday, 17 January 2023 at 11:16:25 UTC, DLearn

Re: More Elegant Settable Methods?

2023-01-21 Thread ryuukk_ via Digitalmars-d-learn
Oops i clicked "Send" too fast

Re: More Elegant Settable Methods?

2023-01-21 Thread ryuukk_ via Digitalmars-d-learn
```D TestStruct ts = { a: 2, b: 3, op: (s) { return s.a + s.b; } }; ``` This simple! just like with C's designated initializers

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-22 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: D is not java/C#, it's better than that! ```D // api.d void draw(){} // app.d import API = api; void main() { API.draw(); } ```

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-25 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 23 January 2023 at 00:11:17 UTC, thebluepandabear wrote: On Sunday, 22 January 2023 at 18:30:59 UTC, ryuukk_ wrote: On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: D is not java/C#, it's better than that! ```D // api.d void draw(){} // app.d import API =

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-03 Thread ryuukk_ via Digitalmars-d-learn
Are you sure you have installed the version 2.5 in your system? Can you check in y our library folder if it's there?

Re: SFML D bindings: libsfml-system.so.2.5: cannot open shared object file:

2023-02-03 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 4 February 2023 at 04:42:04 UTC, ryuukk_ wrote: Are you sure you have installed the version 2.5 in your system? Can you check in y our library folder if it's there? Nvm, i saw your github issue, looks like you have the proper version I have tested on arch linux and everything w

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 compile

Re: ImportC "no include path set"

2023-02-07 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote: On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote: On Monday, 6 February 2023 at 06:55:02 UTC, Elfstone wrote: So how am I supposed to set the include path? https://dlang.org/spec/importc.html#preprocessor The -Ppreproce

Re: ImportC "no include path set"

2023-02-07 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 7 February 2023 at 14:01:00 UTC, Elfstone wrote: On Tuesday, 7 February 2023 at 13:10:44 UTC, ryuukk_ wrote: On Tuesday, 7 February 2023 at 06:25:59 UTC, Elfstone wrote: On Monday, 6 February 2023 at 14:35:53 UTC, bachmeier wrote: [...] Thanks, it worked, but I still get the link

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
I think you need to do: ``` rdmd MLP.d -I ANN/ ``` Basically you need to tell the compiler where your imported packages are

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
Glad it worked! I wonder why DMD doesn't just parse the import and follow its path since module name must correspond to its path Does anyone know?

Re: Want a module to import from a sister directork; How?

2023-02-14 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 14 February 2023 at 21:55:24 UTC, Adam D Ruppe wrote: On Tuesday, 14 February 2023 at 21:23:26 UTC, ryuukk_ wrote: module name must correspond to its path this is not true. I thought it had to match, that's interesting

Re: Debugging memory leaks

2023-02-17 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 15 February 2023 at 18:21:34 UTC, Hipreme wrote: I want to know if there is some way to debug memory leaks in runtime. I have been dealing with that by using a profiler and checking D runtime function calls. Usually those which allocates has high cpu usage so it can be easy for

Re: [OT] (Go) Do I read it right?

2023-02-17 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 16 February 2023 at 18:15:28 UTC, Kagamin wrote: https://github.com/dominikh/go-tools/issues/917 How go programmers cope with this feature? The idea is nice, they do not use exceptions, but the implementation is very poor as you can see From what i read, they have plans to impr

Re: How to get only the field name from an alias?

2023-02-20 Thread ryuukk_ via Digitalmars-d-learn
I'm not sure what the solution is for your specific question, but there is some alternative way you could do: (no longer need function on your struct) I tried to comment the lines, even thought i'm not sure i remember everything correctly, but it compiles :p More info: https://dlang.org/spec

Re: CompilerInvocationException

2023-02-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 February 2023 at 07:11:55 UTC, Paul Backus wrote: Since `Expression` contains `Binary` and `Unary`, and `Binary` and `Unary` contain `Expression`, that means `Expression` contains itself--which is not allowed, because it would result in `Expression.sizeof` being infinite. It sho

Re: CompilerInvocationException

2023-02-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 February 2023 at 14:17:50 UTC, ryuukk_ wrote: On Sunday, 26 February 2023 at 07:11:55 UTC, Paul Backus wrote: Since `Expression` contains `Binary` and `Unary`, and `Binary` and `Unary` contain `Expression`, that means `Expression` contains itself--which is not allowed, because it

Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
Hello, I encountered a weird issue, my program segfault when i feed DMD with my files and static libs It doesn't when i compile with LDC If i split the compile/link in 2 different steps, then all works correctly DMD (1step: ⛔): https://gist.github.com/ryuukk/f0ae2ae0c8980219c04d0c6d86789

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
It crashes with a weird message, address doesn't match the mangled name: ``C:\dev\kdom\projects\dawn\gl\glad\loader.d`` inside: ``module dawn.gl.glad.loader;`` ![screenshot](https://i.imgur.com/sY2KcgR.png)

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew Cattermole wrote: There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from here it should give you hints as to why its trying to writ

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 21:38:23 UTC, ryuukk_ wrote: On Thursday, 2 March 2023 at 21:21:14 UTC, Richard (Rikki) Andrew Cattermole wrote: There isn't anything we can do without source. But here is what I would do in this situation: 1. Look at the assembly at the point of debug break, from

  1   2   3   >