Re: How to "stringnify"?

2021-10-10 Thread evilrat via Digitalmars-d-learn
On Sunday, 10 October 2021 at 08:28:30 UTC, rempas wrote: Is there a way to "stringnify" in Dlang? In C we would do something like the following: `#define STRINGIFY(x) #x` What's the equivalent in D? That's probably depends on what you are trying to achieve. If you want to write code-like

Re: What is the meaning of @future ?

2021-09-18 Thread evilrat via Digitalmars-d-learn
On Saturday, 18 September 2021 at 08:02:13 UTC, Dylan Graham wrote: On Friday, 17 September 2021 at 14:37:29 UTC, Meta wrote: On Friday, 17 September 2021 at 10:31:34 UTC, bauss wrote: On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: [...] It's just another "useless" attribute

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Saturday, 21 August 2021 at 23:50:51 UTC, Ruby The Roobster wrote: On Saturday, 21 August 2021 at 23:50:08 UTC, Ruby The Roobster wrote: On Saturday, 21 August 2021 at 06:08:17 UTC, evilrat wrote: First parameter for CreateWindow should be window class string that you used in

Re: C to D convertor

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Saturday, 21 August 2021 at 08:14:22 UTC, Виталий Фадеев wrote: I know, i know... It not possible, but part of the C code we can to convert to the D. Show me, please, solutions, projects, tools, scripts, docs. Can you give the link ? `htod` is 1. Any more ? dstep

Re: std.stdio.File is throwing with the message of: "Access Violation"

2021-08-21 Thread evilrat via Digitalmars-d-learn
On Friday, 20 August 2021 at 21:19:09 UTC, Ruby The Roobster wrote: int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { // ... if(!RegisterClassA()) { return 0; } hwnd = CreateWindowA( "Test",

Re: D equivalent of C++ explicit

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 18:04:58 UTC, Tejas wrote: On Thursday, 19 August 2021 at 17:43:59 UTC, Paul Backus wrote: On Thursday, 19 August 2021 at 17:38:14 UTC, Tejas wrote: As the topic says: Is there an equivalent to C++'s `explicit` keyword in D? No, because all constructors are

Re: How to call destructor before free without dropping @nogc?

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 15:12:03 UTC, Ferhat Kurtulmuş wrote: On Thursday, 19 August 2021 at 07:30:38 UTC, Bienlein wrote: Hello, I allocate some instance of class C manually and then free the memory again: [...] I just wanted to leave this here.

Re: How to call destructor before free without dropping @nogc?

2021-08-19 Thread evilrat via Digitalmars-d-learn
On Thursday, 19 August 2021 at 08:25:23 UTC, Bienlein wrote: Oops, I just realized that you can also not call emplace when @nogc is present. Well that is at least consistent with not either being able to call destroy ;-). So, I guess this means that you can forget about manually allocating

Re: Two major problems with dub

2021-08-04 Thread evilrat via Digitalmars-d-learn
On Wednesday, 4 August 2021 at 07:21:56 UTC, Denis Feklushkin wrote: On Sunday, 1 August 2021 at 17:37:01 UTC, evilrat wrote: vibe-d - probably because it handles DB connection and/or keep things async way, sure you probably can do it with Phobos but it will be much more PITA and less

Re: Two major problems with dub

2021-08-01 Thread evilrat via Digitalmars-d-learn
On Sunday, 1 August 2021 at 17:25:26 UTC, Alain De Vos wrote: A simple example, dub package dpq2 pulls in, money,vide-d,stdx-allocator,derelict-pq,derelict-util This all for a handfull of C-functions. let's see Money - fits pretty ok, cause your average SQL has decimal type for that purpose

Re: Two major problems with dub

2021-08-01 Thread evilrat via Digitalmars-d-learn
On Sunday, 1 August 2021 at 15:38:32 UTC, Alain De Vos wrote: 2. Let's say you need bindings to postgresql library and you will see dub pulling in numerous of libraries, which have nothing at all to do with postgresql. More like a framework stuff. This creates unneeded complexity, bloatware,

Re: How to create friends of a class at compile time?

2021-07-15 Thread evilrat via Digitalmars-d-learn
On Thursday, 15 July 2021 at 17:49:06 UTC, Tejas wrote: I'm sorry, I should've explicitly mentioned I'm interested in learning how to do friend injection in D. I know that access specifiers operate at module scope, seen a few posts about that here already. Thank you for answering though.

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 19:06:42 UTC, Tejas wrote: But how scalable will this be? We have to get real D code to enrich our ambiguously-defined-small ecosystem. It says bindings generator, but it has to convert the code keeping the semantic as close as possible. It does direct

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:09:02 UTC, Tejas wrote: Sorry, I'm rather ignorant when it comes to this, but why can't we use [pegged](https://github.com/PhilippeSigaud/Pegged) to transpile C++ code to D? Then we won't need a nogc compatible std library and so many other things could get

Re: Why can't we transpile C++ to D?

2021-06-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 10 June 2021 at 15:57:44 UTC, Imperatorn wrote: On Thursday, 10 June 2021 at 15:09:02 UTC, Tejas wrote: Sorry, I'm rather ignorant when it comes to this, but why can't we use [pegged](https://github.com/PhilippeSigaud/Pegged) to transpile C++ code to D? Then we won't need a nogc

Re: Class member initialization with new points to a single instance?

2021-06-09 Thread evilrat via Digitalmars-d-learn
On Wednesday, 9 June 2021 at 17:56:24 UTC, Gregor Mückl wrote: Consider the following code: ```d class Foo { } class Bar { Foo foo = new Foo(); } void main() { Bar b1 = new Bar(); Bar b2 = new Bar(); assert(b1.foo != b2.foo); } ``` The assert fails. This is

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-07 Thread evilrat via Digitalmars-d-learn
On Monday, 7 June 2021 at 14:02:14 UTC, Prokop Hapala wrote: Basically I'm desperate do find anything which encapsulates OpenGL calls into some nice D-lang classes to learn from it. I don't really want to use Dagon, nor Godot. What I want is to use it as learning resources fro learning

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-02 Thread evilrat via Digitalmars-d-learn
On Wednesday, 2 June 2021 at 05:43:49 UTC, evilrat wrote: Yep, use Skia/Cairo or something like this, don't build your own full blown 2D engine for every possible graphics API. I would like to tune my C++ bindings generator to be able to handle Skia ASAP, but can't tell when it will be

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-01 Thread evilrat via Digitalmars-d-learn
Btw there is also (dear) imgui, which is immediate mode GUI that builds geometry to draw for you, how one would draw it is up to programmer. It is very popular in game dev because there is very little setup to get it working. Source https://github.com/ocornut/imgui D bindings with GL3 demo

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2021-06-01 Thread evilrat via Digitalmars-d-learn
On Tuesday, 1 June 2021 at 20:07:39 UTC, Prokop Hapala wrote: After some sime I tried to return to this, using dependency on older version of dagon I got errors in dlib Not sure how to understadn this ``` Error: incompatible types for (box.pmax) - (box.center): both operands are of type

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-06-01 Thread evilrat via Digitalmars-d-learn
On Tuesday, 1 June 2021 at 06:31:28 UTC, Ola Fosheim Grostad wrote: On Tuesday, 1 June 2021 at 05:27:41 UTC, Imperatorn wrote: On Tuesday, 1 June 2021 at 03:32:50 UTC, someone wrote: [...] Yeah, "fragmentation" is a problem. We do a lot of things 90%. We need more "100% projects" that are

Re: wanting to try a GUI toolkit: needing some advice on which one to choose

2021-05-30 Thread evilrat via Digitalmars-d-learn
On Sunday, 30 May 2021 at 07:03:38 UTC, Chris Piker wrote: On Thursday, 27 May 2021 at 07:00:32 UTC, Imperatorn wrote: I would like to recommend DlangUI [1], but we have tried now for months to get in contact with the owner of it (to take over development) and are getting no reponse. 1.

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 18:12:27 UTC, Gavin Ray wrote: On Tuesday, 25 May 2021 at 18:03:00 UTC, evilrat wrote: That last one with someInt is what I warned about. D ctor messed up class layout, in this simple case where class data isn't used it almost works, but will be practically unusable

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 17:52:14 UTC, Gavin Ray wrote: ```d void main() { Derived dlangDerived = new Derived(123); printf("[D] Derived.Base1::getSomething() = %d \n", dlangDerived.getSomething()); printf("[D] Derived.Base2::getOtherThing() = %d \n", dlangDerived.getOtherThing());

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 08:10:25 UTC, sighoya wrote: On Tuesday, 25 May 2021 at 02:47:19 UTC, Gavin Ray wrote: The below seems to work at least, which is encouraging: Awesome! At least, it becomes problematic with fields in base classes, it would be nice if we could map them to @property

Re: How does inheritance and vtables work wrt. C++ and interop with D? Fns w/ Multiple-inheritance args impossible to bind to?

2021-05-25 Thread evilrat via Digitalmars-d-learn
On Tuesday, 25 May 2021 at 02:47:19 UTC, Gavin Ray wrote: Unfortunately, it does not work if I try to add `final int getSomething()` or the other one to the D interfaces, it throws a symbol error because the mangled names are slightly different: ```sh unresolved external symbol "public:

Re: gtkd ,drawingarea, capture mouse pressed

2021-05-21 Thread evilrat via Digitalmars-d-learn
On Friday, 21 May 2021 at 12:28:36 UTC, Alain De Vos wrote: On a gtkd drawingarea I want to capture the mouse-pressed event and get the coordinates of the pointer on the area. I have ``` addEvents(GdkEventMask.BUTTON_PRESS_MASK); ``` Maybe I must add a signal-handler ? Not a gtk user, but

Re: What is the difference between these template declaration forms?

2021-05-15 Thread evilrat via Digitalmars-d-learn
On Saturday, 15 May 2021 at 08:37:21 UTC, cc wrote: Are these identical? Or is there a different usage for the (T : something) form? ```d auto opCast(T)() if (is(T == bool)) { return _obj !is null; } ``` They are the same in this case. ```d auto

Re: Cannot access frame pointer of a struct with member function

2021-05-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 9 May 2021 at 17:37:40 UTC, Andrey Zherikov wrote: Compilation of this code: ```d auto foo(T)() { return T(); // Error: cannot access frame pointer of `onlineapp.main.T` } void main() { struct T { int a=1; void argsFunc(int a) {} // (1) }

Re: SDL2 Android vulkan question

2021-05-02 Thread evilrat via Digitalmars-d-learn
On Sunday, 2 May 2021 at 16:06:10 UTC, Danny Arends wrote: On Sunday, 2 May 2021 at 12:35:51 UTC, evilrat wrote: As for SDL2, are you sure it was built with Vulkan support? That's the thing I worry about, since the SDL2 libraries are locally build using android studio and I'm kind of a noob

Re: SDL2 Android vulkan question

2021-05-02 Thread evilrat via Digitalmars-d-learn
On Sunday, 2 May 2021 at 12:35:51 UTC, evilrat wrote: On Sunday, 2 May 2021 at 08:58:30 UTC, Danny Arends wrote: Any thoughts on why loading the Vulkan library using SDL2 would not work ? thoughts in general about the process ? Just few tips. GC "crashes" since you have custom main, D

Re: SDL2 Android vulkan question

2021-05-02 Thread evilrat via Digitalmars-d-learn
On Sunday, 2 May 2021 at 08:58:30 UTC, Danny Arends wrote: Any thoughts on why loading the Vulkan library using SDL2 would not work ? thoughts in general about the process ? Just few tips. GC "crashes" since you have custom main, D default main has runtime initialization code so it "just

Re: Deriving a D-class from a CPP-class

2021-04-29 Thread evilrat via Digitalmars-d-learn
On Wednesday, 28 April 2021 at 19:46:00 UTC, Alain De Vos wrote: It is rather clear what I want to achieve but virtual functions give me headache because dlang does not now the word virtual. It's virtual by default. The opposite is `final`.

Re: How to skip class/function when using -HC flag to generate C++ headers?

2021-04-19 Thread evilrat via Digitalmars-d-learn
On Monday, 19 April 2021 at 17:37:31 UTC, MoonlightSentinel wrote: On Monday, 19 April 2021 at 16:26:20 UTC, evilrat wrote: Or maybe there is a way to tell it whitelist/blacklist modules? The header generator only translates modules passed on the command line, other declarations are omitted

How to skip class/function when using -HC flag to generate C++ headers?

2021-04-19 Thread evilrat via Digitalmars-d-learn
It is annoying, it tries to write all derived classes where it only needs interface. Or maybe there is a way to tell it whitelist/blacklist modules? Marking class private is not an option.

Re: How to allow +=, -=, etc operators and keep encapsulation?

2021-04-12 Thread evilrat via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:16:14 UTC, Jack wrote: Give this class: ```d class A { int X() { return x; } int X(int v) { return x = v;} private int x; } ``` I'd like to allow use ```+=```, ```-=``` operators on ```X()``` and keep encapsulation. What's a somehow

Re: Why I need DUB? Will never DMD don't just use import for import packages?

2021-04-08 Thread evilrat via Digitalmars-d-learn
On Thursday, 8 April 2021 at 21:36:02 UTC, Alain De Vos wrote: The most important task is "give me a list of to include .d files" "give me a list of the link libraries .a .so" sure, use -v flag, this will give you compiler flags and other info ``` dub build -v ``` this will give you

Re: Creating a .di file for a custom C library

2021-03-30 Thread evilrat via Digitalmars-d-learn
On Tuesday, 30 March 2021 at 04:01:12 UTC, Brad wrote: I would like to use an updated version of the Termbox library (written in C) with D. I have the .h file. This is new territory for me (why try something easy - right?). I think I need to create a .di file that corresponds to the .h

Re: How to declare "type of function, passed as an argument, which should have it's type inferred"? (or if D had an "any" type)

2021-03-29 Thread evilrat via Digitalmars-d-learn
On Monday, 29 March 2021 at 17:52:13 UTC, Gavin Ray wrote: Trying to read this function signature: void my_func(T, XS)(string a, string b, string c, lazy T function(XS)[] t...) Does this say "Generic void function 'my_func', which takes two generic/type params "T" and "XS", and is a

Re: How to declare "type of function, passed as an argument, which should have it's type inferred"? (or if D had an "any" type)

2021-03-29 Thread evilrat via Digitalmars-d-learn
On Monday, 29 March 2021 at 15:13:04 UTC, Gavin Ray wrote: Brief question, is it possible to write this so that the "alias fn" here appears as the final argument? auto my_func(alias fn)(string name, string description, auto otherthing) The above seems to work, since the type of "fn" can

Re: WinUI 3

2021-03-15 Thread evilrat via Digitalmars-d-learn
On Monday, 15 March 2021 at 16:41:08 UTC, Imperatorn wrote: Could D be used with WinUI 3? https://docs.microsoft.com/en-us/windows/apps/winui/winui3/ Would the win32metadata help? 樂 I've seen some slides about WinUI 3 future directions and roadmap but haven't tried it yet. Probably it will

Re: Is there an easy way to convert a C header to a D module?

2021-03-14 Thread evilrat via Digitalmars-d-learn
On Monday, 15 March 2021 at 02:43:01 UTC, Tim wrote: On Monday, 15 March 2021 at 02:03:09 UTC, Adam D. Ruppe wrote: On Monday, 15 March 2021 at 01:53:31 UTC, Tim wrote: I'm needing to use a c/c++ library in a D program and I'm struggling with creating a binding as it seems like an enormous

Re: Workaround to "import" an exception from a DLL

2021-03-14 Thread evilrat via Digitalmars-d-learn
On Sunday, 14 March 2021 at 09:35:40 UTC, frame wrote: // this returns null in the program (but works in a debugger watch): MyExceptionObj imported = cast(MyExceptionObj)e; // this actually works: MyExceptionObj imported = cast(MyExceptionObj) cast(void*)e; Is there are way to copy the

Re: Can't I allocate at descontructor?

2021-03-04 Thread evilrat via Digitalmars-d-learn
On Friday, 5 March 2021 at 05:31:38 UTC, Jack wrote: The following code returns a memory error. I did notice it did happens whenever I did a memory allocation. Is this not possible in the descontrutor? if so, why? GC prohibits allocation during collection, since this dtor is likely called

Re: Shared library module system with dub

2021-03-01 Thread evilrat via Digitalmars-d-learn
On Tuesday, 2 March 2021 at 04:26:52 UTC, Pillager86 wrote: On Tuesday, 2 March 2021 at 04:13:31 UTC, Pillager86 wrote: On Tuesday, 2 March 2021 at 03:42:14 UTC, Pillager86 wrote: Update: the dub "dynamicLibrary" target option is busted on Windows and does not build anything at all. This

Re: How can I make this work?

2021-02-27 Thread evilrat via Digitalmars-d-learn
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback function. How is the casting from LPARAM to my type array done in

Re: DUB is not working correctly

2021-02-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 February 2021 at 18:20:38 UTC, Maxim wrote: On Friday, 26 February 2021 at 17:57:12 UTC, ryuukk_ wrote: "targetType": "executable", and it should just run using "dub run" Unfortunately, the problem remains :/ Looks like something specific to your machine. The last thing

Re: DUB is not working correctly

2021-02-24 Thread evilrat via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 17:45:56 UTC, Maxim wrote: Unfortunately, I tried bindbc-sfml package but the problem is still existing. I also started a new project and without any changes ran it but the result was the same. Anyway, thank you so much for your help! does it works for an

Re: DUB is not working correctly

2021-02-24 Thread evilrat via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 16:46:20 UTC, Maxim wrote: Sure, here are dub.json contents: { "authors": [ "Max" ], "copyright": "Copyright © 2021, Max", "description": "A minimal D application.", "license": "proprietary",

Re: DUB is not working correctly

2021-02-24 Thread evilrat via Digitalmars-d-learn
On Wednesday, 24 February 2021 at 16:13:48 UTC, Maxim wrote: Hello, I have problems with working in dub environment. If I try to init my project with 'dub init', all needed files will be created successfully. However, when I run 'dub run', the manager gives me an error: 'Configuration

Re: is it posible to compile individual module separately?

2021-02-16 Thread evilrat via Digitalmars-d-learn
On Tuesday, 16 February 2021 at 07:01:53 UTC, bokuno_D wrote: i run "dub build" on it. but OOM kill the compiler. - is there a way to reduce memory consumtion of the compiler? or maybe third party tool? alternative to dub? Assuming you are using DMD, there is -lowmem switch to enable garbage

Re: Is there other way to do that?

2021-02-15 Thread evilrat via Digitalmars-d-learn
On Monday, 15 February 2021 at 07:26:56 UTC, Jack wrote: I need to check if an instance is of a specific type derived from my base class but this class has template parameter and this type isn't available at time I'm checking it. Something like: Non-templated interface/base class is

Re: Can change vtbl record at runtime ?

2021-02-03 Thread evilrat via Digitalmars-d-learn
On Wednesday, 3 February 2021 at 08:26:05 UTC, Max Haughton wrote: On Wednesday, 3 February 2021 at 05:30:37 UTC, Виталий Фадеев wrote: Possible to change the vtbl record at runtime ? Has functional for update vtbl records ? Do you mean "Can I set onSuccess" at runtime? The virtual tables

Re: Class Allocators

2021-01-31 Thread evilrat via Digitalmars-d-learn
On Sunday, 31 January 2021 at 23:19:09 UTC, Kyle wrote: My best guess right now is that both class allocators and the placement new syntax are deprecated, but if that's the case I would expect a deprecation message when I try to use that new(address) Type syntax whether there's a class

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread evilrat via Digitalmars-d-learn
On Thursday, 28 January 2021 at 18:37:37 UTC, Ruby The Roobster wrote: Here is the output/input of the program: Type in data for an egg: Width: 3 Hight: 2 object.Error@(0): Integer Divide by Zero 0x004023FE 0x0040CF9F 0x0040CF19 0x0040CDB4 0x00409033 0x00402638 0x75F86359 in

Re: Dll crash in simplest case

2021-01-25 Thread evilrat via Digitalmars-d-learn
On Monday, 25 January 2021 at 11:30:45 UTC, Vitalii wrote: On Monday, 25 January 2021 at 10:26:20 UTC, frame wrote: [...] Yes. I'm doing it whet add dll.d (https://wiki.dlang.org/Win32_DLLs_in_D) in compile line, it contents: --- import core.sys.windows.windows; import

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-24 Thread evilrat via Digitalmars-d-learn
On Sunday, 24 January 2021 at 11:44:04 UTC, Marcone wrote: Qt5 dlls Well, you are out of luck. It is doable, but... Normally you would likely want to use static libraries and link them into your executable, with Qt license however it becomes problematic in pretty much any case, you still

Re: How can I create a Standalone Bundle Portable file application using Dlang?

2021-01-19 Thread evilrat via Digitalmars-d-learn
On Tuesday, 19 January 2021 at 11:10:25 UTC, Marcone wrote: On Tuesday, 19 January 2021 at 06:25:31 UTC, Imperatorn wrote: On Monday, 18 January 2021 at 19:42:22 UTC, Marcone wrote: How can I create a Standalone Bundle Portable file application using Dlang? Could you describe what you mean

Re: How can I specify flags for the compiler when --build=release in dub?

2021-01-15 Thread evilrat via Digitalmars-d-learn
On Friday, 15 January 2021 at 17:02:32 UTC, Jack wrote: is this possible? if so, how? You can add extra options for for platform and compiler, and IIRC for build type too. For example like this for lflags, it might complain about the order so just follow the instructions. "lflags-debug"

Re: Why doesn't this work when the function is a static method?

2021-01-14 Thread evilrat via Digitalmars-d-learn
On Thursday, 14 January 2021 at 05:44:43 UTC, Jack wrote: On Wednesday, 13 January 2021 at 17:21:23 UTC, Paul Backus wrote: Member functions (including static ones) can't be called with UFCS. is this documented somewhere? Is this going to change? It will stay as is. It is somewhat

Re: How to debug D on Linux

2021-01-13 Thread evilrat via Digitalmars-d-learn
if you are looking for back trace someone recently posted a hint for linux where there is no back trace by default is to import core.sys.linux.backtrace or something that has back trace info and using it in exception handler for runtime to print the stack trace.

Re: Collections in D

2021-01-13 Thread evilrat via Digitalmars-d-learn
On Wednesday, 13 January 2021 at 12:06:05 UTC, Roguish wrote: What about sets? There is no specific set container, they just implemented as generic algorithms over the ranges. There is a section for set operations (std.algorithm.setops module). https://dlang.org/phobos/std_algorithm.html

Re: How build DCD on Windows?

2021-01-11 Thread evilrat via Digitalmars-d-learn
On Tuesday, 12 January 2021 at 00:35:41 UTC, Marcone wrote: Hi, Someone can Help me build exe dcd server and client on WIndows? Step by step? Becouse the informations disponible is very hard to undestand. Are you serious? It's on the first page of their repo under the Setup section

Re: Developing and running D GUI app on Android

2021-01-11 Thread evilrat via Digitalmars-d-learn
On Monday, 11 January 2021 at 07:38:00 UTC, Elronnd wrote: On Monday, 11 January 2021 at 06:26:41 UTC, evilrat wrote: Android itself is just linux under the hood, however the launcher starts java process that fires up your activity class (main in native languages) from there you just call your

Re: Developing and running D GUI app on Android

2021-01-10 Thread evilrat via Digitalmars-d-learn
On Sunday, 10 January 2021 at 18:58:13 UTC, aberba wrote: I'm looking to explore running a D application on Android based on Adams previous foundation work. However, I'm not familiar with the Android + D integration so I need some help. Has any of you successfully done that? Could use a

Re: C++ or D?

2020-12-23 Thread evilrat via Digitalmars-d-learn
On Wednesday, 23 December 2020 at 18:03:56 UTC, frame wrote: It's not the problem mentioned but I had to struggle with DLLs and D's Variant-type. The problem is that Variant uses TypeInfo which does not pass DLL boundaries correctly so that int != int in runtime even it's in fact a simple

Re: Getting started with graphqld

2020-12-17 Thread evilrat via Digitalmars-d-learn
On Tuesday, 15 December 2020 at 16:25:29 UTC, Trustee wrote: connect a basic vibe-d app to a graphql backend. umm, what? Did you mean write graphql backend using vibe.d?

Re: Iterating chars by Word

2020-11-12 Thread evilrat via Digitalmars-d-learn
On Friday, 13 November 2020 at 05:14:08 UTC, Виталий Фадеев wrote: Is: wchar[] chars; // like a: "import core.sys.windows.windows;\nimport std.conv : to;\n" Goal: foreach ( word; chars.byWord ) { // ... } You can make your own range, however look at this function first (second

Re: Getting Qte5 to work

2020-10-28 Thread evilrat via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 11:46:02 UTC, Josh Dredge wrote: Hi all, I'm completely new to D and while I'm not new to programming in general, I mostly do web development, Welcome! If by web development you also have back-end programming then you should be like 50% know how desktop

Re: How to compile Windows exe files from this source

2020-08-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 9 August 2020 at 19:04:07 UTC, Marc wrote: I don't know much more about D than creating a 'hello world' exe file with the DMD Compiler but I'm interested in using the eBay/tsv-utils binaries. Unfortunately, the author didn't create any MS Windows binaries:

Re: Bind C++ class to DLang : undefined reference to `Canvas::Foo()'

2020-07-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 July 2020 at 09:34:35 UTC, zoujiaqing wrote: I changed string to basic_string. /// source/main.d import std.stdio; import core.stdcpp.string; extern(C++) { class Canvas { @disable this(); static Canvas Create(); basic_string!ubyte Foo();

Re: Does std.net.curl: download have support for callbacks?

2020-06-11 Thread evilrat via Digitalmars-d-learn
On Thursday, 11 June 2020 at 06:05:09 UTC, adnan338 wrote: I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure. Let's say, for example I have a GtkD Widget called "pb" (short for progressBar). I want to download a

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread evilrat via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: Also, the C++ classes make use of templates. Is it still possible to call these classes from D? It should be, I did something similar and it worked. But it was quite some time ago so I don't remember exact situation and any

Re: `this` template params for struct not expressing constness.

2020-06-08 Thread evilrat via Digitalmars-d-learn
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote: Hi, as far as I understand, the `this` template parameter includes constness qualifiers as seen in https://ddili.org/ders/d.en/templates_more.html To apply this I have this following struct: module bst; struct Tree(T) { T item;

Re: Linker error under Ubuntu

2020-05-15 Thread evilrat via Digitalmars-d-learn
On Friday, 15 May 2020 at 23:49:37 UTC, solidstate1991 wrote: Dub should do the linking by itself. How does it know what to link?

Re: Linker error under Ubuntu

2020-05-14 Thread evilrat via Digitalmars-d-learn
On Thursday, 14 May 2020 at 16:09:16 UTC, solidstate1991 wrote: When I try to compile my own project under Ubuntu with dub, I get the following linker error: /usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd'

Re: Can I use Dlang in Qt5 instead C++ for develop Android Apps?

2020-04-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 April 2020 at 21:01:50 UTC, Baby Beaker wrote: I want develop Android apps using Qt5. But C++ is very hard. I want to use Dlang becouse Dlang is very easy. In theory nothing stops you from doing that. In practice however you have to deal with C++ anyway, how API matches ABI, and

Re: Is it possible to store different subclasses in one array?

2020-04-12 Thread evilrat via Digitalmars-d-learn
On Monday, 13 April 2020 at 04:21:48 UTC, Leonardo wrote: foreach (ref gi; GameItems) { if (gi == Weapon) gi.Attack() } How would it be? Replying myself... weapon = cast(Weapon) gi; if (weapon !is null) weapon.Attack() can be simplified as: if (auto weapon =

Re: Link error undefined symbol: __imp__InterlockedIncrement@4 on windows

2020-04-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 9 April 2020 at 14:07:10 UTC, Clayton Alves wrote: I'm trying to compile my first hello world dub project, but when I run "dub" it spits this error: lld-link: error: undefined symbol: __imp__InterlockedIncrement@4 Does anybody have any clues what is going on ? This is from

Re: A question about C++ interop

2020-03-28 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 March 2020 at 19:14:38 UTC, YD wrote: Hi, now I have a further question: when the C++ class A actually has a method that looks like virtual void get_info(std::string ) const = 0; in order to preserve the virtual function table layout (I found that if I omit this

Re: dub libs from home directory on windows

2020-03-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 March 2020 at 19:53:58 UTC, jmh530 wrote: On Wednesday, 18 March 2020 at 15:10:52 UTC, Виталий Фадеев wrote: On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to

Re: AA code 50x slower

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Monday, 17 February 2020 at 02:18:15 UTC, AlphaPurned wrote: But the input to the AA is static, it never changes. I thought D would essentially treat it as a constant and compute it once? (I'm only using the AA in one place but it is in another template that is used twice. I can't

Re: AA code 50x slower

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Sunday, 16 February 2020 at 12:57:43 UTC, AlphaPurned wrote: template AA(string[] S) { auto _do() { int[string] d; foreach(s; S) d[s] = 0; return d; } enum AA = _do; } My best guess is that enum arrays(except strings) and AA's are instantiated every time you access them.

Re: How the hell to split multiple delims?

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Sunday, 16 February 2020 at 09:57:26 UTC, AlphaPurned wrote: 1>Test.d(31): error : template ... 1>Test.d(61): error : template ... 1>Test.d(66): error : cannot implicitly convert expression `l` of type `immutable(char)` to `string` 1>Test.d(31): error : template ... 1>Test.d(79): error :

Re: How to check that import module will succeed?

2019-07-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 July 2019 at 14:56:37 UTC, Andrey Zherikov wrote: Even without static if I get the same result: mixin template my_import(alias modName) { mixin("import " ~ modName ~ ";"); } mixin my_import!"mymod"; pragma(msg,fullyQualifiedName!(myfunc)); // Error: undefined identifier

Re: How to check that import module will succeed?

2019-07-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote: Is there a way to check whether some module, say "foo", is available for import before doing "import foo"? I did some really retarded utility like this in the past, worked for me, but I can't say it is that well tested and there

Re: Wrong vtable for COM interfaces that don't inherit IUnknown

2019-07-15 Thread evilrat via Digitalmars-d-learn
On Monday, 15 July 2019 at 22:01:25 UTC, KytoDragon wrote: I am currently trying to write a XAudio2 backend and have come across the problem, that some of the interfaces for XAudio2's COM objects seem to be missing the first entry in their vtable. After reading the iterface article in the spec

Re: Heterogeneous Variadic Arguments with Other Arguments

2019-07-14 Thread evilrat via Digitalmars-d-learn
On Sunday, 14 July 2019 at 03:51:14 UTC, harakim wrote: I wanted to do this: package int serialize(byte[] destination, int offset, T...)(T values) Can't really tell what's going on without call site and what do you exactly mean by "heterogeneous arguments with other arguments", but

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:00:01 UTC, Rémy Mouëza wrote: I though support for C++ allocation had improved. In a recent release, there was the addition of core.stdcpp.new, but I didn't try it out: - http://dpldocs.info/experimental-docs/core.stdcpp.new_.html -

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 05:37:08 UTC, ChangLoong wrote: If I want call cpp class constructer without new method, is there a way to do that ? If what you really want is to actually allocate using C++ new operator from D, then that is very problematic and not portable even across

Re: How can I override the defeat compiler select by Dub?

2019-06-23 Thread evilrat via Digitalmars-d-learn
On Sunday, 23 June 2019 at 23:10:48 UTC, Mike Brockus wrote: If you never seen Meson before then pick up a camera and take a picture: 樂  https://mesonbuild.com/ Nope. Wasn't working on Windows last time I checked. Hometown Meson user here simply just wondering how can I tell Dub to use

Re: Using python in D

2019-06-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 9 June 2019 at 03:42:23 UTC, rnd wrote: Thanks for guidance. I also wanted to know: Once executable is successfully created, will it work on systems where Python and pandas are not installed? That is unlikely. PyD is just a D package, it doesn't have the ability to mess up with

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread evilrat via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote: 1 - 17 ms, 553 ╬╝s, and 1 hnsec fancy useless asci hieroglyphic Holy shirt! All that time I was thinking this is just some sort of encoding artifacts in terminal(common problem on windows), especially because IIRC on Linux it is

Re: is there a way to embed python 3.7 code in D program?

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 21:29:18 UTC, Danny Arends wrote: "ImportError: No module named 'stuff'" How do I make the py_import file from pyd find the stuff.py file ? On Linux PYTHONPATH doesn't have current directory by default, so a hacky way to do it is to add it to PYTHONPATH prior to

Re: C Style char**

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 09:24:34 UTC, Doug Clayton wrote: Hi All, First time poster :) I'm working on getting a binding to Vulkan working properly in D, but I've run into a roadblock. The good news is that the binding seems to work fine, but I'm having an issue getting a parameter that

Re: is there a way to embed python 3.7 code in D program?

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 03:06:07 UTC, evilrat wrote: https://github.com/Superbelko/pyd-min Here. Super minimal example, ptvsd can be commented out as well, it is there entirely for debugging. Pardon me, somehow I was completely misread the original question... Well, maybe someone else

Re: is there a way to embed python 3.7 code in D program?

2019-05-12 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 01:35:58 UTC, evilrat wrote: I have project using pyd with python 3.7, that also using ptvsd (visual studio debugger for python package) to allow mixed debugging right inside VS Code. I'll reduce the code and upload somewhere later.

Re: is there a way to embed python 3.7 code in D program?

2019-05-12 Thread evilrat via Digitalmars-d-learn
On Sunday, 12 May 2019 at 22:36:43 UTC, torea wrote: ok, I'll do some more tests with pyd then. And if I cannot get it to work, I'll have a look at the package! I have project using pyd with python 3.7, that also using ptvsd (visual studio debugger for python package) to allow mixed

Re: OT - Git training Lon/HK and book recommendation on taste in programming

2019-05-01 Thread evilrat via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: Second question. Lots of people these days start to program to solve their problems at work but they may never have been shown the basic principles of design, structuring and maintenance of their code. If I could give them one

Re: DLL creation fails with undefined symbol error

2019-04-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 April 2019 at 14:20:24 UTC, dokutoku wrote: Error: linking with LLD failed C:\ldc\bin\ldc2.exe failed with exit code 1. Ok, I have Visual Studio and SDKs installed so it works for me without touching anything else. In your case it is using lld linker instead, and I have no

  1   2   3   >