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

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

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

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

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

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

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

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

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

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

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 :