Re: I want an exception message but my threaded callback just dies or crashes

2019-06-10 Thread Markus via Digitalmars-d-learn
I have cleaned it up, kind of. Just in case you want to compile it. The Zip contains some DLL from https://github.com/spatialaudio/portaudio-binaries where you can find the original if you want. https://gofile.io/?c=NpUxrJ I'm in general thinking of buying a Mac. I know it has not much to do

I want an exception message but my threaded callback just dies or crashes

2019-06-10 Thread Markus via Digitalmars-d-learn
Hi, when you use core.windows and LoadLibrary to load a DLL, and that DLL will create a new thread and inside that it will call back into your D app, is there something to special to be aware of? I've done it like with the CreateWindow and WndProc, but this time I'm loading a compiled portaud

Re: Function parameters UDAs

2019-06-10 Thread Machine Code via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 02:24:49 UTC, Adam D. Ruppe wrote: On Tuesday, 11 June 2019 at 02:04:13 UTC, Machine Code wrote: I also, quite disappointed how UDAs doesn't work with enums. I end up using struct + enum to simulate that, sometimes it's quite a work. They do now... struct foo {}

Re: curl: can't send email?

2019-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 10 June 2019 at 16:10:07 UTC, Andrew wrote: smtp.mailTo = [" There's a missing > in that string. idk if that is making a difference though, the error messages in this are awful.

Re: Function parameters UDAs

2019-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 11 June 2019 at 02:04:13 UTC, Machine Code wrote: I also, quite disappointed how UDAs doesn't work with enums. I end up using struct + enum to simulate that, sometimes it's quite a work. They do now... struct foo {} enum Foo { @foo a } void main() { foreach(item;

Re: Function parameters UDAs

2019-06-10 Thread Machine Code via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote: Looks like that there is no easy way to extract a function parameters UDA list. The following: ``` import std.traits; struct s { string foo; } void foo(@s("aaa") int a, bool x); void main() { alias P = Parameters!foo; enum ud

Re: Function parameters UDAs

2019-06-10 Thread ag0aep6g via Digitalmars-d-learn
On 11.06.19 01:12, Johannes Loher wrote: I would like to iterate over all parameters of a function using static foreach and then process each parameter's UDAs. But by using static foreach on the parameter tuple, slicing it is not possible anymore, so the suggested workaround does not work in th

Re: Function parameters UDAs

2019-06-10 Thread Johannes Loher via Digitalmars-d-learn
On Wednesday, 14 November 2018 at 18:05:55 UTC, Adam D. Ruppe wrote: On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote: Looks like that there is no easy way to extract a function parameters UDA list. Indeed, the only way I can find is kinda crazy: --- void foo(int f, @("test") string

Re: if (X !is null && X.Y !is null) access crash

2019-06-10 Thread Amex via Digitalmars-d-learn
On Monday, 10 June 2019 at 19:48:18 UTC, Steven Schveighoffer wrote: On 6/9/19 1:25 AM, Amex wrote: On Saturday, 8 June 2019 at 20:44:13 UTC, Steven Schveighoffer wrote: Try GC.addRef on the X reference, and see if it helps. This is during shutdown so I imagine simply turning off the GC sho

Re: if (X !is null && X.Y !is null) access crash

2019-06-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/9/19 1:25 AM, Amex wrote: On Saturday, 8 June 2019 at 20:44:13 UTC, Steven Schveighoffer wrote: Try GC.addRef on the X reference, and see if it helps. This is during shutdown so I imagine simply turning off the GC should work fine? That way it prevents all cases rather than having to ad

Re: curl: can't send email?

2019-06-10 Thread Andre Pany via Digitalmars-d-learn
On Monday, 10 June 2019 at 16:10:07 UTC, Andrew wrote: What wrong? ``` import std.net.curl; [...] Curl smtp is a low level api. You need to know SMTP RFC. Please have a look here, this is a high level API on top of curl smtp: https://github.com/adamdruppe/arsd/blob/master/email.d Kind rega

Re: meson and d

2019-06-10 Thread Andre Pany via Digitalmars-d-learn
On Monday, 10 June 2019 at 16:51:15 UTC, dkd wrote: hi, In theory though you can point it at any D compiler by setting the "DC" environment variable. i found at early morning, that by setting variable at system level(through my computer->environment setting) meson can detect d. it is the

Re: meson and d

2019-06-10 Thread dkd via Digitalmars-d-learn
hi, In theory though you can point it at any D compiler by setting the "DC" environment variable. i found at early morning, that by setting variable at system level(through my computer->environment setting) meson can detect d. it is the old usual way of setting variable that i almost forgo

curl: can't send email?

2019-06-10 Thread Andrew via Digitalmars-d-learn
What wrong? ``` import std.net.curl; void main() { auto smtp = SMTP("smtps://smtp.gmail.com:465"); smtp.setAuthentication("qwe...@gmail.com", "password"); smtp.mailTo = ["std.net.curl.CurlException@std/net/curl.d(4364): Failed sending data to the peer on handle 55FACCB58AC0 ---

Re: meson and d

2019-06-10 Thread Matthias Klumpp via Digitalmars-d-learn
On Sunday, 9 June 2019 at 13:13:28 UTC, dkd wrote: hi, i need some meson configuration that works with dmd and ldc my setting don't work. because meson complains it cannot find the d compiler. d compiler can be invoked on command line. i use : set dmd_path="path/to/d/base" set PATH=%dmd_path

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread vitalfadeev via Digitalmars-d-learn
Thanks! I happy! You are really powerfull!

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2019-06-10 at 08:02 +, vitalfadeev via Digitalmars-d-learn wrote: […] Perhaps I am missing something that is critical to the example, but I rewrote the code as: import std.algorithm: map; import std.stdio: writeln; bool false_cb() { return false; } bool true_cb() { retur

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread Anonymouse via Digitalmars-d-learn
On Monday, 10 June 2019 at 08:02:18 UTC, vitalfadeev wrote: On Monday, 10 June 2019 at 07:45:42 UTC, vitalfadeev wrote: On Monday, 10 June 2019 at 07:41:40 UTC, vitalfadeev wrote: How to? I plan scan First array with checkers: [checker, checker, checker] ...and store result to Second array: [

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread vitalfadeev via Digitalmars-d-learn
On Monday, 10 June 2019 at 07:45:42 UTC, vitalfadeev wrote: On Monday, 10 June 2019 at 07:41:40 UTC, vitalfadeev wrote: How to? I plan scan First array with checkers: [checker, checker, checker] ...and store result to Second array: [0, 0, 1] In next code 'r' not reference. But expected ref.

Re: How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread vitalfadeev via Digitalmars-d-learn
On Monday, 10 June 2019 at 07:41:40 UTC, vitalfadeev wrote: How to? I plan scan First array with checkers: [checker, checker, checker] ...and store result to Second array: [0, 0, 1] In next code 'r' not reference. But expected ref. import std.range : zip; foreach(checker, ref r; zip(

How to walk over two arrays by ref in beautyfull way?

2019-06-10 Thread vitalfadeev via Digitalmars-d-learn
How to? I plan scan First array with checkers: [checker, checker, checker] ...and store result to Second array: [0, 0, 1] In next code 'r' not reference. But expected ref. import std.range : zip; foreach(checker, ref r; zip(checkers, result.set)) { r = checker(); } What is