Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 March 2023 at 22:24:11 UTC, H. S. Teoh wrote: On Thu, Mar 02, 2023 at 09:55:55PM +, ryuukk_ via Digitalmars-d-learn wrote: 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 > Catterm

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
I couldn't figure out dustmite, so i started from 0 and managed to hit something: https://github.com/ryuukk/dmd_bug ``Assertion failed: array index out of bounds, file game\app.d, line 5`` Wich indicates probably TLS problem? This now reminds me of: https://issues.dlang.org/show_bug.cgi?id

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:11:06 UTC, Vladimir Panteleev wrote: On Friday, 3 March 2023 at 01:07:07 UTC, ryuukk_ wrote: I couldn't figure out dustmite, so i started from 0 and managed to hit something: https://github.com/ryuukk/dmd_bug ``Assertion failed: array index out of bounds, file g

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:24:42 UTC, Richard (Rikki) Andrew Cattermole wrote: This works: ```d extern(C) void main() { Stuff[5] temp = [ Stuff(), Stuff(), Stuff(), Stuff(), Stuff(), ]; stuffs = temp[]; stuffs[0].do_something(); } ``` `

Re: Bug in DMD?

2023-03-02 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 01:37:42 UTC, Richard (Rikki) Andrew Cattermole wrote: On 03/03/2023 2:33 PM, ryuukk_ wrote: So it is a DMD bug? Yes and thanks to you I can now say that we can absolutely get rid of DllMain requirement for DLLs! glad the outcome is positive, and i apologies about

Re: Some questions with D and webassembly

2023-03-03 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 03:32:37 UTC, TheZipCreator wrote: In webassembly, there's a type called `externref`, which opaquely represents a javascript object. So, you could do this for example, with this javascript: ```js class Foo { constructor(x) { this.x = x;

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread ryuukk_ via Digitalmars-d-learn
What happens if you put the dll next to your executable, does it find it?

How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
Hello, I am trying to build: https://github.com/dlang-community/DCD/ as a static lib In the DCD's dub i changed targetType to "staticLibrary" Then i build: ``dub build -c library`` for the library config But now the weird part On my program i try to link it and i get bunch of unreloved s

Re: How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 6 March 2023 at 01:46:22 UTC, Richard (Rikki) Andrew Cattermole wrote: In the DCD's dub i changed targetType to "staticLibrary" You didn't need to do that, the default was correct. Then i build: ``dub build -c library`` for the library config Just ``$ dub build`` would've done i

Re: How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
Use dub, don't do this manually. i build DCD with DUB, not manually i ask dub to give me a static lib, dcd.lib is the file he gave me, that should be all i yet i get the errors

Re: How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 6 March 2023 at 02:00:16 UTC, Mike Parker wrote: On Monday, 6 March 2023 at 01:52:06 UTC, ryuukk_ wrote: 6B71D90\dparse.lib -g ``` Are you saying dub doesn't build a static dcd.lib? What to do to make it so i get a static dcd.lib file that contains all the code it needs? This co

Re: How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 6 March 2023 at 01:57:21 UTC, Richard (Rikki) Andrew Cattermole wrote: On 06/03/2023 2:52 PM, ryuukk_ wrote: Are you saying dub doesn't build a static dcd.lib? It did, but it doesn't contain any of the dependencies. What to do to make it so i get a static dcd.lib file that contain

Re: How to build a static lib properly?

2023-03-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 6 March 2023 at 02:54:42 UTC, Ruby The Roobster wrote: On Monday, 6 March 2023 at 00:55:04 UTC, ryuukk_ wrote: Hello, I am trying to build: https://github.com/dlang-community/DCD/ as a static lib [...] Try ```dub build --build-mode=allAtOnce```. That didn't work However, chan

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

2023-03-06 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 7 March 2023 at 01:45:27 UTC, John Xu wrote: I'm new to dlang. I didn't find much tutorials on internet about how to read/write Chinese easily. std.encoding doesn't seem to support GBK or GB18030: "Encodings currently supported are UTF-8, UTF-16, UTF-32, ASCII, ISO-8859-1 (also kn

Re: Is there a way to get the name of the current function?

2023-03-07 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 7 March 2023 at 22:11:49 UTC, rempas wrote: For example, in the given code: ```d void my_function() { import std.stdio; writeln("The name of the function is: ", ); } ``` Is there something to put in the place of `` to get the name of the function? ``` import std.stdio; vo

Re: DlangUI Layout Justification

2023-03-09 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 9 March 2023 at 10:11:04 UTC, Ron Tarrant wrote: Has anyone else been using D to develop for Android? If so, have you documented your process/GUI toolkit choices and would you be willing to share with me? Adam has something for Android: https://github.com/adamdruppe/d_android

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

DMD: what's the proper way to get a list of symbols from a Module object?

2023-03-13 Thread ryuukk_ via Digitalmars-d-learn
Hello, I am playing a little bit with DMD to get familiar with it (just to get a basic overview of it) I'm trying to come up with a proof of concept for https://github.com/dlang/DIPs/blob/master/DIPs/DIP1044.md ```D enum Tester { KNOWN = 1, WITHAUTO = 2 } void func(Tester a, Tester

Any ways to get addr2line working with DMD? works fine with GDC

2023-03-16 Thread ryuukk_ via Digitalmars-d-learn
Hello, I'm trying to catch segfaults, after reading lot of ressources online, i came up with this: ```D import core.stdc.signal: SIGSEGV, SIGFPE, SIGILL, SIGABRT, signal; import core.stdc.stdlib: free; import core.stdc.string: strlen; import core.sys.posix.unistd: STDERR_FILENO, readlink; impo

Re: Any ways to get addr2line working with DMD? works fine with GDC

2023-03-17 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 17 March 2023 at 20:53:07 UTC, WB wrote: On Thursday, 16 March 2023 at 22:07:04 UTC, ryuukk_ wrote: Hello, The problem is when i compile with DMD i get: ``` ??:0 ``` When i compile it with GDC i get proper file + line What does GDC do different than DMD? Is there a way to get t

Re: Any ways to get addr2line working with DMD? works fine with GDC

2023-03-21 Thread ryuukk_ via Digitalmars-d-learn
I found what was the issue!! https://stackoverflow.com/a/63856113 The 0x55XX address you got is most likely the memory address of the function after the EXE is loaded from disk. addr2line only recognizes VMA addresses like the ones that you got from disassembling with objdump. It no

Re: Any ways to get addr2line working with DMD? works fine with GDC

2023-03-21 Thread ryuukk_ via Digitalmars-d-learn
I found what was the issue!! https://stackoverflow.com/a/63856113 The 0x55XX address you got is most likely the memory address of the function after the EXE is loaded from disk. addr2line only recognizes VMA addresses like the ones that you got from disassembling with objdump. It no

Re: Watch me beat a dead horse. Super simple program...

2023-03-22 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 22 March 2023 at 19:33:45 UTC, WhatMeWorry wrote: Ok, I've gotten rid of dub and dub packages code. Just LoadLibraryA. All eight dlls work except for FreeImage.dll. I've compiled with dmd and -m64 option and freshly download a x64 FreeImage. Any Window users out there that use Loa

Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
Hi, It's common knowledge that accessing tls global is slow http://david-grs.github.io/tls_performance_overhead_cost_linux/ What i do not understand is the reasoning behind choosing tls global by default in D What i find even more weird is writing fast code is ugly in D Look at this ugly c

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
Perhaps in ``-betterC`` tls vars should be annotated with ``@tls``, and the default is not tls just like in C?

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
With -betterC it's broken for 3 years btw: https://issues.dlang.org/show_bug.cgi?id=20737

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:29:17 UTC, Nick Treleaven wrote: On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: What i find even more weird is writing fast code is ugly in D Look at this ugly code ```D __gshared int fast_code_ugly; ``` Because it should be rare that __gshared is use

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:25:54 UTC, Richard (Rikki) Andrew Cattermole wrote: Having TLS by default is actually quite desirable if you like your code to be safe without having to do anything extra. As soon as you go into global to the process memory, you are responsible for synchronizatio

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 19:08:32 UTC, Steven Schveighoffer wrote: On 3/26/23 2:07 PM, ryuukk_ wrote: Hi, It's common knowledge that accessing tls global is slow http://david-grs.github.io/tls_performance_overhead_cost_linux/ What i do not understand is the reasoning behind choosing tls

How to debug and watch globals in windows debugger?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
I tried to look around, what ever i try, nothing works There is a mention of "fully qualified" here: https://forum.dlang.org/post/peb1jj$tr$1...@digitalmars.com But what does that mean? I tried this: ![screenshot](https://i.imgur.com/JZooIic.pngg) But it doesn't work

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Anyone got an idea? Executable built with : ``dmd -g -debug`` on windows On Visual Studio with the visuald addon i can debug the executable and inspect the globals On VSCode i can debug the executable and inspect locals, but not globals What does visuald does under the hood to be able to i

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
If anyone know what is the problem exactly, then please speak up, this problem needs to be reported to the right place fixed so it can be fixed, all languages i tested don't have this issue (c, rust, zig, odin) D is not a toy language, let's take this issue seriously, shall we? or is it?..

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 27 March 2023 at 19:31:24 UTC, Richard (Rikki) Andrew Cattermole wrote: The person you need is WebFreak and they are not online right now. On IRC earlier today ``` [6:43:29 pm] nope, I haven't gotten globals to work in debugger before [6:43:33 pm] I don't think they are emitted

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
To clarify, i tested both dmd/ldc, they both doesn't work on windows To clarify even more: I am a mere user who wants to debug its program on windows using vscode's debugger wich uses msvc I can debug a c/rust/zig executable without issue and see globals The problem only happens with dmd/ld

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Two questions for the D team: Does globals have a special syntax? as you can see above i also tried the mangled name inside the PDB (using hex viewer https://github.com/WerWolv/ImHex) Walter, how do you debug your programs written in D?

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
Fore more clarity, all syntax i have tried: ``` type_to_tiledef kshared.defs.type_to_tiledef _D7kshared4defs15type_to_tiledef kshared:defs:type_to_tiledef kshared::defs::type_to_tiledef kshared->defs->type_to_tiledef ```

Re: Is there a -Dmacro like option for D compilers?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 27 March 2023 at 22:22:26 UTC, Jeremy wrote: Is there a way I can define a manifest constant from the compiler command-line, like the -Dmacro option for C compilers? You can do this way: ``` dmd -version=FEATURE_A ``` ```D import std.stdio; void main() { version(FEATURE_A)

Re: Is there a -Dmacro like option for D compilers?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
I just remembered you can do something like this! ``` import std.stdio; enum FEATURE_A_AVAILABLE() { version(FEATURE_A) return true; else return false; } void main() { static if (!FEATURE_A_AVAILABLE) { writeln("feature A not available"); } } ``` It's evaluated at

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
I've now waste an entire day trying to figure out what's wrong, perhaps trusted D for my projects was a bad idea, i now look like a fool

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 01:06:50 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. I did not try mago, but it shouldn't be needed as pdb is universally understood by tools It also

Re: How to debug and watch globals in windows debugger?

2023-03-27 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 01:21:02 UTC, Richard (Rikki) Andrew Cattermole wrote: On 28/03/2023 2:06 PM, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions for vs-code in README. Binaries are available in the inst

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 04:22:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 28/03/2023 2:25 PM, ryuukk_ wrote: On Tuesday, 28 March 2023 at 01:06:50 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago? https://github.com/rainers/mago There are instructions

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 11:07:02 UTC, ryuukk_ wrote: On Tuesday, 28 March 2023 at 04:22:24 UTC, Richard (Rikki) Andrew Cattermole wrote: On 28/03/2023 2:25 PM, ryuukk_ wrote: On Tuesday, 28 March 2023 at 01:06:50 UTC, Richard (Rikki) Andrew Cattermole wrote: Have you tried installing mago

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
I opened an issue on microsoft's github, let's see what they have to say: https://github.com/microsoft/vscode-cpptools/issues/10751

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
C program: ```C int notice_me_global = -1; void main() { notice_me_global = -5; } ``` ``cl app_c.c /DEBUG /Zi /EHsc /std:c11 /link /DEBUG /out:app_c.exe`` ``llvm-pdbutil.exe dump --globals app_c.pdb > dump_c`` ``` 688476 | S_GDATA32 [size = 32] `notice_me_global` type = 0x

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
Ready to test folder: https://github.com/microsoft/vscode-cpptools/issues/10751#issuecomment-1486948783 Contains simple source to reproduce the issue + build script Also contains binaries + dump in case you just want to see the data Hopefully we can figure that out

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 14:02:39 UTC, ryuukk_ wrote: Ready to test folder: https://github.com/microsoft/vscode-cpptools/issues/10751#issuecomment-1486948783 Contains simple source to reproduce the issue + build script Also contains binaries + dump in case you just want to see the data

Re: How can I restrict a library to be only included under a certain OS?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 28 March 2023 at 21:10:08 UTC, solidstate1991 wrote: I added this line to my SDLang formatted dub build file: ``` dependency "libx11" version="0.0.1" platform="posix" ``` Yet it's included even on Windows, even if I change it to "linux". Since there's a fatal bug in the library t

Re: How to debug and watch globals in windows debugger?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn
On linux everything works properly out of the box, i tested with gdb and i can inspect globals More info + linux dump on my comment: https://github.com/microsoft/vscode-cpptools/issues/10751#issuecomment-1487694435 So it's a problem either with msvc, or the way dmd/ldc write information for

Re: How to debug and watch globals in windows debugger?

2023-03-29 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 29 March 2023 at 15:26:21 UTC, Steven Schveighoffer wrote: On 3/28/23 6:42 PM, ryuukk_ wrote: Am i the only want who want to improve things, is it a lost cause? I'm not one to use a debugger often, but it is very helpful for many people. I lament that the Windows debugging si

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-31 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 31 March 2023 at 10:26:32 UTC, Nick Treleaven wrote: On Sunday, 26 March 2023 at 20:39:21 UTC, ryuukk_ wrote: if my code doesn't do threads, why should i put my variable into TLS? I don't think writing __gshared is much of a burden. You can use -vtls to print out all variables that

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-31 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 31 March 2023 at 10:32:53 UTC, Nick Treleaven wrote: On Sunday, 26 March 2023 at 20:36:37 UTC, ryuukk_ wrote: Golang doesn't even have thread local storage, yet they do very well Go doesn't have a solution to preventing data races at compile time, they just say don't share memory.

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-31 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 31 March 2023 at 16:02:35 UTC, Dennis wrote: On Friday, 31 March 2023 at 15:52:21 UTC, ryuukk_ wrote: the point i bring is ``__gshared`` is ugly, so we want an ugly language? Good code shouldn't look ugly, but global mutable variables are bad, so it's appropriate that they look ugl

Re: A Programmer's Dilema: juggling with C, BetterC, D, Macros and Cross Compiling, etc.

2023-04-30 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 30 April 2023 at 17:51:15 UTC, Eric P626 wrote: The title of this thread might be weird, but I am currently reconsidering the language and tools I am using before returning to production again. # Objective and projects Make simple turn based (no animation) video games using Allegro

Re: Can dmd compile a favicon.ico to exe file ?

2023-05-11 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 12 May 2023 at 01:41:10 UTC, John Xu wrote: I saw c# program's exe, often have an favicon.ico image bound together, which can be dragged to desktop. Can dmd compile an icon image to an exe also? you can, if i remember correctly create a ``ressource.rc`` file and paste: ``` IDI_I

Re: Best way to convert between GBK/GB18030 to utf8 ?

2023-05-23 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 23 May 2023 at 02:58:21 UTC, John Xu wrote: What is the best way to convert a GBK/GB18030 file contents, i.e. read via: std.stdio.read(gbkFile).to!string , to utf8 encoding ? https://github.com/lytsing/gbk-utf8/blob/master/utf8.c Here, it is C, but porting this to D is easy There

Re: How hide console in dub.sdl under windows 11?

2023-05-25 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 25 May 2023 at 08:37:40 UTC, John Xu wrote: For dmd, I can use a no_console.def file, which has: EXETYPE NT SUBSYSTEM WINDOWS Then `dmd my.d no_console.def` to hide console. But how do I realize it with dub.sdl ? Adding no_console.def to "sourceFiles", doesn't help. you

Re: How make a Dlang with Windows GUI x64 without console?

2023-05-26 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 26 May 2023 at 18:05:38 UTC, Marcone wrote: How can I hide console of a window GUI on Windows x64? I need run with -m64 Someone asked the exact same thing yesterday, check their post: https://forum.dlang.org/thread/azlraopxmidtcdmnr...@forum.dlang.org ``` "lflags-windows": [

Re: Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 27 May 2023 at 13:23:38 UTC, vushu wrote: you can use: ``static if (__traits(hasMember, T, "magma"))`` ```D import std; struct LavaMan { void magma() { writeln(" LavaMan is throwing LAVA"); } } struct FakeVulcano { void try_making_lava() { writeln( " Making fake lava"); } }

Re: Concepts like c++20 with specialized overload resolution.

2023-05-27 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 27 May 2023 at 17:49:27 UTC, vushu wrote: On Saturday, 27 May 2023 at 16:38:43 UTC, Steven Schveighoffer wrote: On 5/27/23 9:50 AM, vushu wrote: On Saturday, 27 May 2023 at 13:42:29 UTC, Basile B. wrote: [...] Yes I know there is template constraint, but not with specialized ov

Re: unittest under betterC

2023-06-04 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 4 June 2023 at 20:43:17 UTC, Richard (Rikki) Andrew Cattermole wrote: Unittests require some mechanism to execute them. Druntime provides this capability by default. You can do it manually by using ``__traits(getUnitTests)`` to get access to the symbols. Personally I just use full

Re: unittest under betterC

2023-06-04 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 4 June 2023 at 22:14:59 UTC, Richard (Rikki) Andrew Cattermole wrote: On 05/06/2023 9:20 AM, ryuukk_ wrote: Then this needs to be fixed asap, unittest needs to work for the flags user will use There is nothing to fix. You literally do not have any of the druntime code needed to ha

Re: unittest under betterC

2023-06-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 5 June 2023 at 11:41:08 UTC, Richard (Rikki) Andrew Cattermole wrote: On 05/06/2023 3:42 PM, ryuukk_ wrote: I don't know how all this works, but the runtime shouldn't know about tests, imagine if you ship a game, and the player can run all the unittests, that doesn't make sense Cur

Re: applay for template function with sumtypes result?

2023-07-04 Thread ryuukk_ via Digitalmars-d-learn
Hopefully we'll get tagged union in the future - no templates - proper support - proper error messages

Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 5 July 2023 at 22:27:46 UTC, Andrew wrote: So, I've gotten the itch to have a go at game development in D, after doing a bit of it in Java last year. I've previously used LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and some other useful libs. The problem is, apparen

Re: Options for Cross-Platform 3D Game Development

2023-07-05 Thread ryuukk_ via Digitalmars-d-learn
Oh, and i forgot to mention Sokol, great C library, i couldn't find D bindings, so you'll have to create your own (it's trivial) https://github.com/floooh/sokol

Re: WASM - Passing JS objects to D

2023-07-25 Thread ryuukk_ via Digitalmars-d-learn
Think about the readers when you paste code https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Re: Syntax for Static Import of User Define Attributes

2023-07-28 Thread ryuukk_ via Digitalmars-d-learn
Whenever there might be symbol clash, or when i want to make sure i can identify where something from from i do: ```d import me = my.awesome.module; void main() { me.hi(); } ```

Re: Make a function available under different names.

2023-07-29 Thread ryuukk_ via Digitalmars-d-learn
There are 2 ways you can solve your problem ```d string returnExecutableName(string[] arguments) { // if you compile with `-debug` it'll run this block debug { write("Debug mode is enabled.\n"); write(" Executable_Name: " ~ arguments[0] ~ "\n");

pragma lib doesn't support static libraries?

2023-07-29 Thread ryuukk_ via Digitalmars-d-learn
Hello, I'm trying to simplify my build script, i have this library that i statically link OS: linux ``dmd app.d mongoose/bin/linux/mongoose.a`` becomes: ``` package mongoose; pragma(lib, "mongoose/bin/linux/mongoose.a"); ``` However, it no longer compile, and it complains about ``undefin

Re: pragma lib doesn't support static libraries?

2023-07-29 Thread ryuukk_ via Digitalmars-d-learn
I should have explained exactly what i am doing.. Looks like it doesn't work when i compile in 2 step - compile with: ``dmd -c of=bin/game.o`` - link with: ``dmd bin/game.o`` When doing it this way, then it doesn't work However, when compiling/linking in one ``dmd`` invocation (without ``-c``

Re: pragma lib doesn't support static libraries?

2023-07-29 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 30 July 2023 at 05:53:55 UTC, Mike Parker wrote: On Sunday, 30 July 2023 at 05:28:32 UTC, ryuukk_ wrote: I should have explained exactly what i am doing.. Looks like it doesn't work when i compile in 2 step - compile with: ``dmd -c of=bin/game.o`` - link with: ``dmd bin/game.o`` Wh

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,

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

<    1   2   3   >