Member not accessible in delegate body

2016-09-23 Thread John C via Digitalmars-d-learn
If I try to call the protected method of a superclass from inside the body of a delegate, the compiler won't allow it. void layoutTransaction(Control c, void delegate() action) { // do stuff action(); // do more stuff } class Control { protected void onTextChanged() {} } class Label :

Re: Member not accessible in delegate body

2016-09-23 Thread John C via Digitalmars-d-learn
On Friday, 23 September 2016 at 18:20:24 UTC, Martin Nowak wrote: Please file a bug report issues.dlang.org, shouldn't be difficult to fix. Done: https://issues.dlang.org/show_bug.cgi?id=16531

Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf?

Re: Convert type tuple to array?

2016-10-05 Thread John C via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 11:46:14 UTC, Adam D. Ruppe wrote: On Wednesday, 5 October 2016 at 11:43:12 UTC, John C wrote: Is there a way to convert something like AliasSeq!(int, int, int) to an int[] - the opposite of aliasSeqOf? If it is a legal array (matching types), just put [] around

Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 01:00:20 UTC, Cleverson Casarin Uliana wrote: Hello all, starting to learn d, apreciating it so far. I'd like to play/stop wave sound files assynchronously on Windows. Can I get a module for that by installing a particular compiler, or is there any package for it

Re: Basic sounds' playing

2016-10-08 Thread John C via Digitalmars-d-learn
On Saturday, 8 October 2016 at 13:35:57 UTC, Cleverson Casarin Uliana wrote: Thank you Vadim and John, the PlaySound function is enough for now. I'm not yet developing an app, just experimenting with some exercises. The wasapi library seems interesting, does it also implement a playSound-like

Re: How to correctly display accented characters at the Windows prompt?

2016-10-10 Thread John C via Digitalmars-d-learn
On Monday, 10 October 2016 at 14:14:08 UTC, Cleverson Casarin Uliana wrote: Hello, when I run a compiled Windows executable at the console, letters outside the ascii range such as ç and ã do not display propperly. Is there any d function to change the console code page on the fly? My Windows co

Re: How to get sqlite3.lib x64?

2016-10-24 Thread John C via Digitalmars-d-learn
On Monday, 24 October 2016 at 05:43:00 UTC, Andre Pany wrote: Hi, I try to get sqlite3.lib for 64 Bit windows os. I tried implib with the def file and the 64 Bit dll: implib sqlite3_implib.lib sqlite3.def /system -> App crash (Windows 10) With the dll file defined: implib sqlite3_implib.lib sq

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-05 Thread John C via Digitalmars-d-learn
On Saturday, 5 November 2016 at 16:13:18 UTC, Sarcross wrote: If you're wondering, I did use the COFF2OMF tool on the library I got from the C# code, which is why in WordFileParser.d you'll see "pragma(lib, "Parser2")". I have never had success trying to link with a lib file converted by COFF

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-05 Thread John C via Digitalmars-d-learn
On Saturday, 5 November 2016 at 21:02:14 UTC, Adam D. Ruppe wrote: coff2omf works with .obj files Well, that's not what the docs say! http://www.digitalmars.com/ctg/coff2omf.html "The input files can be either object files (.obj) or library files (.lib)" Apparently you have to convert t

Re: problem with isnan

2016-11-11 Thread John C via Digitalmars-d-learn
On Friday, 11 November 2016 at 20:55:52 UTC, Charles Hixson wrote: Thank you. Unfortunately: importstd.math; ... assert(isNan (c.curActivation), "cell has unexpected curActivation: %s".format(c.curActivation)); yields: cell.d(292): Error: undefined identifier 'isNan', did

Returning structs from COM

2016-12-03 Thread John C via Digitalmars-d-learn
Some DirectX methods return structs by value, but when I try calling them I either get garbage or an access violation. Usually COM methods return structs by pointer as a parameter, but these are returning the struct as the actual return value, as in this definition: extern(Windows): stru

Re: Proper generic way to get the hash of something?

2016-12-04 Thread John C via Digitalmars-d-learn
On Sunday, 4 December 2016 at 06:51:24 UTC, Tofu Ninja wrote: So what is the proper way to get the hash of something now? This question came up a few days ago: http://forum.dlang.org/post/o1igoc$21ma$1...@digitalmars.com

Re: returning struct, destructor

2016-12-21 Thread John C via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 11:45:18 UTC, Eugene Wissner wrote: This prints 3 times "Destruct" with dmd 0.072.1. If I remove the if block, it prints "Destruct" only 2 times - the behavior I'm expecting. Why? Possibly to do with named return value optimisation.

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:45:11 UTC, John C. wrote: I'm using LDC compiler 1.36.0 on x86_64 Linux system with "-w -O3 -mattr=+avx" compiler flags. I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this flag no errors ar

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 12:56:55 UTC, ryuukk_ wrote: LDC 1.36 = 1 years old latest version is LDC 1.40 with LDC 1.40, your code works on my computer now my turn to ask a question: why were you using a 1 years old compiler version? common sense would be to make sure you are up to dat

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 13:59:09 UTC, John C. wrote: I have tested this code with LDC on run.dlang.io, segmentation fault does occur only if -mattr=+avx is used. Without this flag no errors are produced. Actually, if I use -mcpu=avx with DMD, no error is generated. However, if this flag

core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
Hello everyone. I am complete newbie in D and programming at all and I can't understand why dynamic arrays can't be used within following D code: ```d import std.random : uniform01; import core.simd; void main() { align(32) float[] a = new float[128]; align(32) float[] b = new float[128

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Sunday, 26 January 2025 at 16:43:19 UTC, Johan wrote: The `align(32)` applies to the slice `a`, not the contents of `a` (where `a` points to). Thank you, seems that it is reason for that errors. I remember that dynamic array can be represented as structure with size_t len and pointer to me

Re: core.simd and dynamic arrays

2025-01-26 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 05:53:09 UTC, John C. wrote: Print out the pointer to `a[0]` to verify what the actual alignment is. If we look to output above, first line addresses are aligned to 32 bytes Except address with B(1011) at second from the right position?

Re: core.simd and dynamic arrays

2025-01-27 Thread John C. via Digitalmars-d-learn
On Monday, 27 January 2025 at 15:55:17 UTC, Guillaume Piolat wrote: You may use intel-intrinsics who: 1. guarantees float8 is there 2. have aligned malloc _mm_malloc I have heard about intel-intrinsics and it's really good idea to use it in my code, but I wanted to try some SIMD operations wit

Re: Noob ImportC questions

2025-02-26 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 21:08:19 UTC, monkyyy wrote: I think `import raylib` finds raylib.c Thank you, it were actually using raylib.c in both cases. When I renamed this file, import was made impossible (I think it should have happened?)

Noob ImportC questions

2025-02-26 Thread John C. via Digitalmars-d-learn
Hello everyone. Recently I get interested in some GUI-related stuff and I want to use Raylib in my project. I know about raylib-d, dray, etc. bindings, but I would like to see what can ImportC do for me in this situation. I have following project hierarchy: ``` project/ src/ main.d ra

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 18:53:40 UTC, Kapendev wrote: On Wednesday, 26 February 2025 at 17:00:48 UTC, John C. wrote: Error (with both commands above, same result): ``` main.d(8): Error: undefined identifier `RAYWHITE` main.d(9): Error: undefined identifier `LIGHTGRAY` ``` Both RAYWH

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 08:10:04 UTC, John C. wrote: would removing some "hard to parse" constructs in header file help this situation? I tried to change ``` #define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray ``` To more simpler definition which does not c

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Wednesday, 26 February 2025 at 17:00:48 UTC, John C. wrote: 2. Why main.d version with "Color(...)" replaced by "RAYWHITE" or "LIGHTGREY" (defined in header) will not compile with "undefined identifier" error? I have tested some basic Raylib functionality from examples on their website and

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 12:48:19 UTC, Kapendev wrote: On Thursday, 27 February 2025 at 08:16:33 UTC, John C. wrote: On Thursday, 27 February 2025 at 08:10:04 UTC, John C. wrote: But this change was not helpful, same error occured. Does this mean that ImportC cannot parse object literal

Re: Noob ImportC questions

2025-02-27 Thread John C. via Digitalmars-d-learn
On Thursday, 27 February 2025 at 13:33:55 UTC, John C. wrote: all code I have tested worked perfectly. Of course, I had to rewrite all "RAYWHITE" to "raywhite", etc., but I'm happy to have working GUI library now!