Re: ldc2 failed with exit code -1073741819.

2022-01-18 Thread russhy via Digitalmars-d-learn
Compiling the project without: version "Colours" works So the problem lies here in this struct: https://github.com/zorael/kameloso/blob/9ccff29ead6ca2e80e2db0f06085c751326ed578/source/kameloso/constants.d#L320

Re: compiler fails with fatal error LNK1318: Unexpected PDB-error: OK (0) ""

2022-01-03 Thread russhy via Digitalmars-d-learn
On Monday, 3 January 2022 at 09:20:57 UTC, Simon wrote: oops this went into the wrong forum! Sorry! I will repost this as a compiler issue, any moderator feel free to delete this post. Are you using dub? if the problem appeared over night, then it sounds like a cache issue, probably due

Re: How to gets multi results using tuple in D?

2021-12-23 Thread russhy via Digitalmars-d-learn
it's one of those things where D is starting to fall behind competition when it comes to quality of life features while OP's example is not that bad, the AliasSeq is plain and simple just confusing.. it's a NO also removing the need of import for tuple is needed!! it's the same with

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread russhy via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 18:51:38 UTC, Stanislav Blinov wrote: On Tuesday, 21 December 2021 at 15:42:59 UTC, russhy wrote: Please keep us updated, that'll be interesting to see how a pure D printf would look like! It already exists, it's called std.format.write.formattedWrite, in

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread russhy via Digitalmars-d-learn
Please keep us updated, that'll be interesting to see how a pure D printf would look like!

Re: How to properly use variadic templates (functions)?

2021-12-20 Thread russhy via Digitalmars-d-learn
Here how i'd do, but i'm not sure how to keep track of the index of the arguments, i forgot.. ```D import core.stdc.stdio: putc, stdout; void print(T...)(string prompt, T args) { foreach (a; args) { alias A = typeof(a); static if (is(A : string)) {

Re: unit test broken [DUB bug?]

2021-12-12 Thread russhy via Digitalmars-d-learn
You are running the beta version of the compiler, and an older version of LDC2 I'd first try to update them to make sure you aren't missing any bug fixes

Re: How to loop through characters of a string in D language?

2021-12-11 Thread russhy via Digitalmars-d-learn
On Saturday, 11 December 2021 at 18:51:12 UTC, Rumbu wrote: On Saturday, 11 December 2021 at 14:42:53 UTC, russhy wrote: Here is mine - 0 allocations - configurable - let's you use it how you wish - fast You know that this is already in phobos? ``` "abc;def;ghi".splitter(';').joiner

Re: How to loop through characters of a string in D language?

2021-12-11 Thread russhy via Digitalmars-d-learn
Here is mine - 0 allocations - configurable - let's you use it how you wish - fast ```D import std; void main() { string a = "abc;def;ab"; writeln("a => ", a); foreach(item; split(a, ';')) writeln("\t", item); string b = "abc;def ;ab"; writeln("a => ",

Re: Dub fails to run inside a docker container on MacBook

2021-12-02 Thread russhy via Digitalmars-d-learn
The first thing i'd check: - make sure you have curl installed on your docker image - make sure you link with the curl library (since you are using dub) That's on the notes: https://dlang.org/phobos/std_net_curl.html

Re: Debugging D code with GDB

2021-11-28 Thread russhy via Digitalmars-d-learn
On Sunday, 28 November 2021 at 14:53:17 UTC, user1234 wrote: ... there is a plugin to demangle things automatically https://github.com/ANtlord/gdb-ddemangle

Re: How to deploy single exe application (?)

2021-11-15 Thread russhy via Digitalmars-d-learn
On Monday, 15 November 2021 at 21:16:14 UTC, Willem wrote: Using D -- I have created a simple command line utility that download some info via a https API and save it in a sqlite3 database file. To use the exe on another windows machine, I need to copy over the relevant sqlite3 and curl DLL

Re: Completing C code with D style

2021-11-10 Thread russhy via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote: btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. So I really don't give a damn about allocations .. not one little bit ;-) It's not a good mindset to have Give room for the unexpected, don't burn all of your options

Re: Crosscompile to Windows

2021-11-07 Thread russhy via Digitalmars-d-learn
If i remember correctly, all you have to do is: dub build --arch=x86_64-pc-windows-msvc --compiler=ldc2

Re: Completing C code with D style

2021-11-03 Thread russhy via Digitalmars-d-learn
The code "as is" is perfectly fine I don't understand why you guys offer OP such complicate/bloated examples, it'll only make things confusing and slow down compilation time with templates and imports, this is not needed at all One change, use .length property instead of the hardcoded

Re: std.format doesn't want to work

2021-10-16 Thread russhy via Digitalmars-d-learn
On Saturday, 16 October 2021 at 22:47:09 UTC, solidstate1991 wrote: When I make this call ``` format(" %3.3f"w, avgFPS); ``` my program immediately crashes with an access violation error. The debugger out is different between x86 and x86-64. I've made all sanity checks, so I need some other

Re: How to make a function that accepts optional struct but can accept struct literal too

2021-10-15 Thread russhy via Digitalmars-d-learn
On Friday, 15 October 2021 at 21:47:21 UTC, Paul Backus wrote: On Friday, 15 October 2021 at 20:33:33 UTC, JN wrote: Is there some nice way of achieving something like this C99 code in D? ```c #include typedef struct { int x, y; } inputs_t; void foo(inputs_t* optional_inputs) { if

Re: tkd does not build anymore after 2.096

2021-10-13 Thread russhy via Digitalmars-d-learn
But ultimately, if the repo is archived, that means it is not maintained anymore The licence is MIT, so you can fork it and maintain a new updated version, at least an updated one that compiles -- github repos marked as "archived" should be reflected in the code.dlang.org page, dub should

Re: tkd does not build anymore after 2.096

2021-10-12 Thread russhy via Digitalmars-d-learn
On Tuesday, 12 October 2021 at 18:18:45 UTC, tastyminerals wrote: On Tuesday, 12 October 2021 at 17:35:53 UTC, russhy wrote: Recent version for nullable removed implicit conversion, you must call .get now.. wich is a pain to update i suggest using a previous version of ``struct Nullable``

Re: tkd does not build anymore after 2.096

2021-10-12 Thread russhy via Digitalmars-d-learn
Recent version for nullable removed implicit conversion, you must call .get now.. wich is a pain to update i suggest using a previous version of ``struct Nullable`` https://github.com/dlang/phobos/blob/v2.096.1/std/typecons.d create a nullable.d file in tkd project, and replace the imports

Re: Obtain pointer from static array literal

2021-10-09 Thread russhy via Digitalmars-d-learn
On Saturday, 9 October 2021 at 10:44:30 UTC, Some Guy wrote: On Friday, 8 October 2021 at 14:07:27 UTC, russhy wrote: https://run.dlang.io/is/S8uMbp Maybe this is kind of unrelated, but what is happening here and why does it work? It looks like you've replaced the GC's allocation

Re: Obtain pointer from static array literal

2021-10-08 Thread russhy via Digitalmars-d-learn
https://run.dlang.io/is/S8uMbp It's such a shame that ``[0,1,2,3].ptr`` allocates using GC, even if using ``func(scope const void* ptr)`` Can't something be done to make this ``[0,1,2,3]`` a static array literal? Who thought making it GC allocated was a good idea? i want names!

Re: avoid codegen pass

2021-10-02 Thread russhy via Digitalmars-d-learn
On Saturday, 2 October 2021 at 22:40:32 UTC, max haughton wrote: On Saturday, 2 October 2021 at 18:05:06 UTC, Dennis wrote: On Saturday, 2 October 2021 at 16:57:48 UTC, max haughton wrote: Do you have optimizations turned on? i.e. are you compiling with -O by accident? Not needed, it's

Re: Loading assimp

2021-09-29 Thread russhy via Digitalmars-d-learn
On Wednesday, 29 September 2021 at 02:47:09 UTC, Mike Parker wrote: On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a

Re: Loading assimp

2021-09-29 Thread russhy via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 20:09:41 UTC, Eric_DD wrote: On Tuesday, 28 September 2021 at 19:59:09 UTC, russhy wrote: On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to

Re: Loading assimp

2021-09-28 Thread russhy via Digitalmars-d-learn
On Tuesday, 28 September 2021 at 16:30:09 UTC, Eric_DD wrote: I am trying to use a newer version of Assimp. I have found a assimp-vc140-mt.dll (v3.3.1) which I renamed to assimp.dll When running my executable it throws a derelict.util.exception.SharedLibLoadException: "Failed to load one

Re: bindbc-lua :: Return tables from D

2021-09-25 Thread russhy via Digitalmars-d-learn
bindbc-lua expect the function to be nothrow This should work: ```D import std.stdio : writeln; import std.conv : to; import bindbc.lua; void main() { lua_State* L = luaL_newstate(); luaL_openlibs(L); lua_register(L, "funcD", ); string str = "x = funcD()";

Re: zsh: command not found: rdmd

2021-09-20 Thread russhy via Digitalmars-d-learn
On Monday, 20 September 2021 at 11:04:42 UTC, leikang wrote: Enter dmd lk01.d in vscode, the terminal displays zsh: command not found: dmd, an error is reported, I don't know what the problem is, can it only be run in /Users/mac1094/dmd2/osx/bin? How have you installed dmd?

Re: yet another segfault - array out of bound is not caught by try catch

2021-09-18 Thread russhy via Digitalmars-d-learn
Double check in your dub.json file and see if you haven't changed your buildoptions DEBUG: it's caught: https://run.dlang.io/is/F8HkD8 RELEASE: segfault as expected: https://run.dlang.io/is/oLU2M3 And make sure to use latest version of ldc

Re: Nondeterministic unittest debugging problem.

2021-08-16 Thread russhy via Digitalmars-d-learn
remove the .dub folder and try again, as stated in other reply, might be a cache issue, or something that picks an outdated file in the cache

Re: DMD compiler - warning of unused variables

2021-08-16 Thread russhy via Digitalmars-d-learn
On Monday, 16 August 2021 at 14:14:27 UTC, DLearner wrote: Hi Please see code below: ``` void main() { import std.stdio; size_t i; size_t j; i = 5; writeln("i = ",i); } ``` Is there a compiler option that would warn that variable 'j' is defined but not used? Best

Re: Getting a working example of opIndexAssign using opSlice ... have troubles ...

2021-08-15 Thread russhy via Digitalmars-d-learn
There is an example here: http://www.rosettacode.org/wiki/Multi-dimensional_array#D Look at the Matrix struct

Re: Any UML generators for D code?

2021-08-12 Thread russhy via Digitalmars-d-learn
On Thursday, 12 August 2021 at 21:11:24 UTC, JN wrote: I'd like to see the relationships between my D classes in a graphical form. Is there any tool that supports that? found this: https://code.dlang.org/packages/depend also this but it's pretty old: https://github.com/rikkimax/Duml

Re: translate C struct char array into D

2021-07-30 Thread russhy via Digitalmars-d-learn
On Friday, 30 July 2021 at 14:05:58 UTC, workman wrote: I get want to define this struct in D: ```c struct test1 { struct test1 *prev; struct test1 *next; size_t v1; size_t v2; size_t v3; char data[]; }; ``` ```d struct test1 { test1 *prev; test1 *next;

Re: Performance issue with fiber

2021-07-26 Thread russhy via Digitalmars-d-learn
``` build: ``` dub build --compiler=ldc -brelease --single primesv1.d ``` -brelease is a typo issue, i don't think that produce defired effect, most likely it defaulted to debug build it should be -b release

Re: Build time

2021-07-24 Thread russhy via Digitalmars-d-learn
One thing to add: With LDC you can add this flag ``-linkonce-templates`` to get faster link time when using templates a lot

Re: Build time

2021-07-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 July 2021 at 09:12:15 UTC, JG wrote: On Saturday, 24 July 2021 at 08:26:39 UTC, JG wrote: On Friday, 23 July 2021 at 20:03:22 UTC, Dennis wrote: On Friday, 23 July 2021 at 18:53:06 UTC, JG wrote: [...] You can try profiling it with LDC 1.25 or later. Add this to dub.sdl:

Re: assert(false) and GC

2021-07-10 Thread russhy via Digitalmars-d-learn
On Saturday, 10 July 2021 at 16:32:30 UTC, Mathias LANG wrote: On Saturday, 10 July 2021 at 01:38:06 UTC, russhy wrote: On Saturday, 10 July 2021 at 01:23:26 UTC, Steven Schveighoffer wrote: I think it's the throwing/catching of the `Throwable` that is allocating. But I don't know from where

Re: assert(false) and GC

2021-07-09 Thread russhy via Digitalmars-d-learn
On Saturday, 10 July 2021 at 01:23:26 UTC, Steven Schveighoffer wrote: On 7/9/21 8:44 PM, russhy wrote: On Friday, 9 July 2021 at 23:34:25 UTC, Ali Çehreli wrote: On 7/9/21 4:12 PM, russhy wrote: >> One way of forcing compile-time evaluation in D is to >> define an enum >> (which means

Re: assert(false) and GC

2021-07-09 Thread russhy via Digitalmars-d-learn
On Friday, 9 July 2021 at 23:34:25 UTC, Ali Çehreli wrote: On 7/9/21 4:12 PM, russhy wrote: >> One way of forcing compile-time evaluation in D is to define an enum >> (which means "manifest constant" in that use). That's all I meant. It was a general comment. > this is very bad, assert are

Re: assert(false) and GC

2021-07-09 Thread russhy via Digitalmars-d-learn
On Friday, 9 July 2021 at 22:53:10 UTC, Ali Çehreli wrote: On 7/8/21 11:11 AM, DLearner wrote: Hi Please confirm that: `    assert(false, __FUNCTION__ ~ "This is an error message"); ` Will _not_ trigger GC issues, as the text is entirely known at compile time. Best regards One way of

Re: assert(false) and GC

2021-07-09 Thread russhy via Digitalmars-d-learn
i think it only allocate when it hit the assert, but program will halt so it's not big deal, even though i feel this is a stupid design to make everything depend on GC... it gives bad impression when you want avoid it here is how i do to detect hidden GC allocations

Re: how to make D program footprint smaller ?

2021-07-08 Thread russhy via Digitalmars-d-learn
On Thursday, 8 July 2021 at 10:01:33 UTC, dangbinghoo wrote: I have tried to add ``` "dflags": ["--link-defaultlib-shared"], "lflags": ["--as-needed"], ``` to dub.json, and my compiler is ldc2, with 800 loc program used `hibernated` and `asdf` package. it compiled to 27MB binary not

Re: regarding what seems (to me) unnecessary casts on integer expressions

2021-06-07 Thread russhy via Digitalmars-d-learn
Everything is public by default, and you can't overload and derive from structs so final has no effect there less visual noise: ```D struct gudtPosition { void reset() { pintLeft1 = pintTop1 = pintRight1 = pintBottom1 = 0; } private ushort pintLeft1 = 0; private ushort pintTop1 =

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 19:25:47 UTC, Ishax wrote: On Saturday, 24 April 2021 at 18:55:33 UTC, ichneumwn wrote: "Use the lib command. If it's static, lib will show you a pile of .obj files inside. Not so if it's am implib." lib /list foo.lib This is the output of `lib /list

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
Try to add this in your dub file: libs "user32" "gdi32" "shell32"

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:48:49 UTC, Ishax wrote: It's using the same D code as with the dynamic setup which I was able to produce a window with. Yet the .exe functions if I supply it with .dlls. Thats silly. you didn't read my message Remove all the code used to loadSDL, it's not

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 16:10:13 UTC, Ishax wrote: On Saturday, 24 April 2021 at 16:02:27 UTC, russhy wrote: .a are object files for linux right? Are they? I'm not very familiar with c++. I'm using windows. For that matter I should mention I'm using dub in vscode. send us your

Re: Use bindbc-sdl statically

2021-04-24 Thread russhy via Digitalmars-d-learn
On Saturday, 24 April 2021 at 15:58:26 UTC, Ishax wrote: I am trying to get graphics working in D. All seems well with bindbc sdl, but I hit a nitpick: I prefer to be able to create a standalone executable when possible. I cannot get bindbc to be happy with sdl .a files. It's a small problem,

Re: dlang opengl / gl / glu /glut library.

2021-04-21 Thread russhy via Digitalmars-d-learn
On Sunday, 18 April 2021 at 22:35:26 UTC, Alain De Vos wrote: Is there a library with api index ? https://github.com/BindBC/bindbc-opengl use the version block you need: https://github.com/BindBC/bindbc-opengl#enable-support-for-opengl-versions-30-and-higher

Re: Static array initialisation

2021-03-31 Thread russhy via Digitalmars-d-learn
On Wednesday, 31 March 2021 at 17:54:38 UTC, DLearner wrote: On Wednesday, 31 March 2021 at 17:46:25 UTC, Imperatorn wrote: On Wednesday, 31 March 2021 at 17:27:44 UTC, DLearner wrote: Hi I did: immutable uint MemSize=100; // Memory size in bytes. // Memory Pool ubyte[MemSize]