Write native GUI applications for Windows

2017-12-18 Thread Andrey via Digitalmars-d-learn
Hello! I have a question about creating native GUI applications for Windows 7 or/and Windows 10. I know that exist DWT, DlangUI and other... But I'm interesting in native GUI. If it will be C++ then I would use WinAPI from SDK. And what about D? What should I do? Make some kind of wrapper

Re: How to debug GC leak

2017-12-18 Thread Andrew Benton via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:03:14 UTC, Andrew Benton wrote: [snip] Looking at dmd's gc profile, it looks like only std.array.Appender!string has allocated enough to be the culprit. End program memory was 110MB and the Appender!string had allocated 127MB totaly with Appender!(Json[])

Re: Write native GUI applications for Windows

2017-12-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: Hello! I have a question about creating native GUI applications for Windows 7 or/and Windows 10. I know that exist DWT, DlangUI and other... But I'm interesting in native GUI. If it will be C++ then I would use WinAPI from SDK. And

Re: Write native GUI applications for Windows

2017-12-18 Thread Andrey via Digitalmars-d-learn
On Monday, 18 December 2017 at 08:49:51 UTC, Binghoo Dang wrote: You can use libuid which can be found here https://code.dlang.org/packages/libuid. It wrapped the native os gui for d, and it's cross-platform. Nice... But I want to use WinApi. Is it possible? Or what one should do first to

Re: Fold in Parallelism

2017-12-18 Thread Vino via Digitalmars-d-learn
On Sunday, 17 December 2017 at 20:00:53 UTC, Ali Çehreli wrote: On 12/17/2017 08:11 AM, Vino wrote: > As per the document form std.parallelism it states that we can use > taskPool.reduce so can we use the same for fold (taskPool.fold) as > basically both are same with slight variation on seed

Re: Write native GUI applications for Windows

2017-12-18 Thread Andrey via Digitalmars-d-learn
On Monday, 18 December 2017 at 09:45:38 UTC, Mike Parker wrote: You can use the C Windows API out of the box: Aaa, excelent! I always thought that first one should port winapi to D and then use it... Is core.sys.windows.windows equals fully to C WinApi, do you know?

Re: Clarity about extern(Windows)/extern(System)

2017-12-18 Thread Kagamin via Digitalmars-d-learn
On Sunday, 17 December 2017 at 13:36:15 UTC, Mike Parker wrote: My limited testing on a 64-bit Linux VM shows no problems when binding a C function as extern(C) or extern(Windows), and the disassembly looks the same. 64-bit ABI fixed calling convention proliferation, only one cc is used

Re: Write native GUI applications for Windows

2017-12-18 Thread Binghoo Dang via Digitalmars-d-learn
On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: Hello! I have a question about creating native GUI applications for Windows 7 or/and Windows 10. I know that exist DWT, DlangUI and other... But I'm interesting in native GUI. If it will be C++ then I would use WinAPI from SDK. And

Re: How to pack a struct to a ubyte[] in a more "The D way" style ?

2017-12-18 Thread Binghoo Dang via Digitalmars-d-learn
hi Davis, I read the std.bitmanip, and I tried to test the code like below: ``` import std.stdio; import std.array; import std.bitmanip; void main(string[] args) { align(1) struct c { ushort c1; uint c2; //ubyte[8] c3; } ubyte[] buffer; auto ap =

Re: weird exception on windows

2017-12-18 Thread Szabo Bogdan via Digitalmars-d-learn
On Saturday, 16 December 2017 at 12:01:49 UTC, Steven Schveighoffer wrote: On 12/16/17 5:12 AM, bauss wrote: On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe

Re: Clarity about extern(Windows)/extern(System)

2017-12-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 December 2017 at 14:31:38 UTC, Kagamin wrote: https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/x86-Function-Attributes.html#index-functions-that-pop-the-argument-stack-on-x86-32-3 looks like gcc doesn't see it as OS dependent. Thanks. I was playing around on asm.dlang.org and found

DMD Test Suite Windows

2017-12-18 Thread Jonathan Marler via Digitalmars-d-learn
Trying to run the dmd test suite on windows, looks like Digital Mars "make" doesn't work with the Makefile, I tried Gnu Make 3.81 but no luck with that either. Anyone know which version of make it is supposed to work with on windows? Is it supposed to work on windows at all?

Re: Passing anonymous enums as function parameters

2017-12-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-17 20:45, Jonathan M Davis wrote: That's pretty much just declaring manifest constants with braces so that you don't repeat the keyword enum a bunch of times. Anonymous enum is what the spec calls it and was available before manifest constants. -- /Jacob Carlborg

Re: Clarity about extern(Windows)/extern(System)

2017-12-18 Thread Kagamin via Digitalmars-d-learn
From https://gcc.godbolt.org/ __attribute__((stdcall)) int square(int num) { return num * num; } _Z6squarei: push ebp mov ebp, esp mov eax, DWORD PTR [ebp+8] imul eax, DWORD PTR [ebp+8] pop ebp ret 4

Re: Clarity about extern(Windows)/extern(System)

2017-12-18 Thread Kagamin via Digitalmars-d-learn
https://gcc.gnu.org/onlinedocs/gcc-7.2.0/gcc/x86-Function-Attributes.html#index-functions-that-pop-the-argument-stack-on-x86-32-3 looks like gcc doesn't see it as OS dependent.

Re: DMD Test Suite Windows

2017-12-18 Thread Seb via Digitalmars-d-learn
On Monday, 18 December 2017 at 16:06:33 UTC, Jonathan Marler wrote: Trying to run the dmd test suite on windows, looks like Digital Mars "make" doesn't work with the Makefile, I tried Gnu Make 3.81 but no luck with that either. Anyone know which version of make it is supposed to work with on

Re: Write native GUI applications for Windows

2017-12-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-18 08:55, Andrey wrote: Hello! I have a question about creating native GUI applications for Windows 7 or/and Windows 10. I know that exist DWT, DlangUI and other... But I'm interesting in native GUI. If it will be C++ then I would use WinAPI from SDK. DWT _is_ a native GUI, it

Re: Clarity about extern(Windows)/extern(System)

2017-12-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 December 2017 at 10:52:22 UTC, Kagamin wrote: On Sunday, 17 December 2017 at 13:36:15 UTC, Mike Parker wrote: My limited testing on a 64-bit Linux VM shows no problems when binding a C function as extern(C) or extern(Windows), and the disassembly looks the same. 64-bit ABI

Why dynamic lib can't be converted to static and vise versa

2017-12-18 Thread Suliman via Digitalmars-d-learn
I understand that dll can be loaded dynamically, and static lib is allow export functions than embedded to binaries. But what difference in their structure? What stop to export needed function from dynamic lib and embed it to bin?

Re: Array Template

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Saturday, 16 December 2017 at 14:14:28 UTC, Vino wrote: Yes, will give a try. From, Vino.B well, this sort of gets there ;-) // - module test; import std.stdio; import std.variant; import std.typecons; import std.conv; import std.string; void main() { Variant[] arr; auto

Re: Write native GUI applications for Windows

2017-12-18 Thread Kagamin via Digitalmars-d-learn
On Monday, 18 December 2017 at 10:08:13 UTC, Andrey wrote: Is core.sys.windows.windows equals fully to C WinApi, do you know? Should be enough for most things.

Re: DMD Test Suite Windows

2017-12-18 Thread kinke via Digitalmars-d-learn
On Monday, 18 December 2017 at 16:06:33 UTC, Jonathan Marler wrote: Trying to run the dmd test suite on windows, looks like Digital Mars "make" doesn't work with the Makefile, I tried Gnu Make 3.81 but no luck with that either. Anyone know which version of make it is supposed to work with on

Re: Fold in Parallelism

2017-12-18 Thread Russel Winder via Digitalmars-d-learn
Ali, Shouldn't this be a pull request for std.parallelism to be extended? If the function is in std.algorithm, then people should not have to write it for themselves in std.parallelism. On Mon, 2017-12-18 at 11:01 -0800, Ali Çehreli via Digitalmars-d-learn wrote: > […] > > Hi Ali, > > > >

Re: Write native GUI applications for Windows

2017-12-18 Thread Zz via Digitalmars-d-learn
On Monday, 18 December 2017 at 08:49:51 UTC, Binghoo Dang wrote: On Monday, 18 December 2017 at 07:55:25 UTC, Andrey wrote: Hello! I have a question about creating native GUI applications for Windows 7 or/and Windows 10. I know that exist DWT, DlangUI and other... But I'm interesting in

Re: weird exception on windows

2017-12-18 Thread Mengu via Digitalmars-d-learn
On Saturday, 16 December 2017 at 14:05:28 UTC, Vino wrote: On Saturday, 16 December 2017 at 13:59:11 UTC, Vino wrote: On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote: [...] H, All, Are are also getting the same exception on Windows after updating the dmd to version v2.077.1,

Re: Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2017-12-18 Thread WebFreak001 via Digitalmars-d-learn
On Monday, 18 December 2017 at 22:36:44 UTC, WhatMeWorry wrote: I've been using Dub for a while but from the very beginning I decided to go with SDL 100% of the time, So I've got a dub.sdl file like: name "01_10_camera_view_space" description "A minimal D application." authors "kheaser"

How do I pass a type as parameter in this method?

2017-12-18 Thread Marc via Digitalmars-d-learn
Imaginary code: int index = FirstOrDefault!(int)(__traits(getAttributes, C.a)); In that case, if the tuple is empty, the value is the int's type default value. The method is defined as following: template FirstOrDefault(X)(T...) { static if(T.length > 0) { enum

Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2017-12-18 Thread WhatMeWorry via Digitalmars-d-learn
I've been using Dub for a while but from the very beginning I decided to go with SDL 100% of the time, So I've got a dub.sdl file like: name "01_10_camera_view_space" description "A minimal D application." authors "kheaser" copyright "Copyright © 2017, kheaser" license "proprietary"

Re: weird exception on windows

2017-12-18 Thread unleashy via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your

Re: Fold in Parallelism

2017-12-18 Thread Ali Çehreli via Digitalmars-d-learn
On 12/18/2017 02:18 AM, Vino wrote: On Sunday, 17 December 2017 at 20:00:53 UTC, Ali Çehreli wrote: On 12/17/2017 08:11 AM, Vino wrote: >   As per the document form std.parallelism it states that we can use > taskPool.reduce so can we use the same for fold (taskPool.fold) as > basically both

Re: weird exception on windows

2017-12-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/18/17 7:20 AM, Szabo Bogdan wrote: On Saturday, 16 December 2017 at 12:01:49 UTC, Steven Schveighoffer wrote: On 12/16/17 5:12 AM, bauss wrote: On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: alias a = s.i; // illegal, s.i is an expression Actually, as I understand it, the example provided in 10. is legal (because it aliases a type), and the example provided in 3. is illegal (because it aliases an expression) perhaps

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread Mike Franklin via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: I have been looking at the following example found right at the end of the section here: https://dlang.org/spec/declaration.html#alias struct S { static int i; } S s; alias a = s.i; // illegal, s.i is an expression alias b = S.i;

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 01:30:07 UTC, Mike Franklin wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why you would say that is a bug. i.e. // import std.stdio; struct S { int j; } void main() {

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: alias a = s.i; // illegal, s.i is an expression alias a = s.i; (this is an alias to a type, since s.i is an int) Hence it is actually 'legal', as far as I understand. i.e... "AliasDeclarations create a symbol that is an alias for

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread Meta via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: Hello, I have been looking at the following example found right at the end of the section here: https://dlang.org/spec/declaration.html#alias struct S { static int i; } S s; alias a = s.i; // illegal, s.i is an expression alias b

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread Mike Franklin via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 02:04:34 UTC, codephantom wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why you would say that is a bug. I meant that the example is wrong, and a bug report should be filed to fix the example. Mike

Re: How do I pass a type as parameter in this method?

2017-12-18 Thread Ali Çehreli via Digitalmars-d-learn
On 12/18/2017 03:54 PM, Ali Çehreli wrote: On 12/18/2017 02:58 PM, Marc wrote: Here's another experiment: template FirstOf(T...) { template otherwise(D) { static if (T.length == 0) { enum otherwise = D.init; } else { enum otherwise = T[0]; }

Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread Michael via Digitalmars-d-learn
Hello, I have been looking at the following example found right at the end of the section here: https://dlang.org/spec/declaration.html#alias struct S { static int i; } S s; alias a = s.i; // illegal, s.i is an expression alias b = S.i; // ok b = 4; // sets S.i to 4 and it runs

Re: How do I pass a type as parameter in this method?

2017-12-18 Thread Ali Çehreli via Digitalmars-d-learn
On 12/18/2017 02:58 PM, Marc wrote: Imaginary code: int index = FirstOrDefault!(int)(__traits(getAttributes, C.a)); In that case, if the tuple is empty, the value is the int's type default value. The method is defined as  following: template FirstOrDefault(X)(T...) { static