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

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

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

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

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

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

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

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 ~= () =>

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

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

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

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

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

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

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

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

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

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,

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

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

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

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;

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)

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

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.

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

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

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

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

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

Re: pragma lib doesn't support static libraries?

2023-07-30 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``

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

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

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");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1   2   3   >