Error: variable foo forward referenced

2017-07-06 Thread Nicholas Wilson via Digitalmars-d-learn
Why does this: enum AddrSpace { Global,Shared } struct Pointer(AddrSpace as, T) { T* ptr; alias ptr this; } struct AutoIndexed(T) if (is(T : Pointer!(n,U),AddrSpace n,U)) { T p; private @property auto idx() { static if (n == AddrSpace.Global) return

Re: Bulk allocation and partial deallocation for tree data structures.

2017-07-06 Thread Filip Bystricky via Digitalmars-d-learn
On Tuesday, 4 July 2017 at 03:52:39 UTC, Moritz Maxeiner wrote: First of all thank you for your responses! On Tuesday, 4 July 2017 at 02:53:00 UTC, Filip Bystricky wrote: On Tuesday, 4 July 2017 at 01:56:11 UTC, Moritz Maxeiner wrote: [...] However, in many cases it is unacceptable to have

Re: Need simple sound

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 17:33:49 UTC, FoxyBrown wrote: I think the autoDLL if done right. I hacked it together and worked easier than I thought but didn't put in the time to make it nice. It could avoid libs all together, not that we need to do that. Still need a h/di file, of course.

Re: Panda Antivirus puts the latest dmd installer in quarantine

2017-07-06 Thread Ecstatic Coder via Digitalmars-d-learn
VirusTotal analysis : https://www.virustotal.com/fr/file/d12e9521ab0ad6a9c0babadeb789692b625fa3535ff406f27a7f47a096430a99/analysis/ The following malware signatures were detected a few hours ago : Baidu Win32.Trojan.WisdomEyes.16070401.9500.9674 20170706 CAT-QuickHeal Trojan.Generic 20170

Re: GtkD nothing

2017-07-06 Thread Marco Leise via Digitalmars-d-learn
Am Thu, 06 Jul 2017 03:49:04 + schrieb FoxyBrown : > Unfortunately, importing that module seems to throw an error for > some insane reason. > > Error 42: Symbol Undefined _D3gtk6All12__ModuleInfoZ > (gtk.AllGTK.__ModuleInfo) > > without importing it in to the project(but

Re: Need simple sound

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
Heres a better version that automatically generates a class wrapping the portaudio.dll. Need portaudio.di(possibly renamed to portaudio.d and imported). Still same problem as original though. import portaudio; import std.conv, std.stdio; import core.stdc.stdio; alias BOOL = ubyte; alias

Re: AutoDLL

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
Here is a solution that will wrap all extern C functions and allow one to then map them to a dll. auto BuildDLLClassFromCHeader(alias modulename, string name)() { import std.traits, std.algorithm, std.meta; auto s = "extern (C) class " ~name~"\n{\n\timport ___import =

Re: Panda Antivirus puts the latest dmd installer in quarantine

2017-07-06 Thread bauss via Digitalmars-d-learn
On Thursday, 6 July 2017 at 18:33:35 UTC, Ecstatic Coder wrote: But no problem with any file stored inside the current .7z archive file. So I guess the problem comes from the installer executable itself. Please try to fix this as soon as possible, as this immediately drives people away

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jul 06, 2017 at 06:49:51PM +, unleashy via Digitalmars-d-learn wrote: > On Thursday, 6 July 2017 at 16:16:17 UTC, H. S. Teoh wrote: > > Which version of the compiler are you using? I just tested on the > > latest dmd git HEAD, and it (correctly) tells me that it's illegal > > to

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread unleashy via Digitalmars-d-learn
On Thursday, 6 July 2017 at 16:16:17 UTC, H. S. Teoh wrote: Which version of the compiler are you using? I just tested on the latest dmd git HEAD, and it (correctly) tells me that it's illegal to override a non-virtual function. I'm surprised you got your code to compile at all. `dmd

Panda Antivirus puts the latest dmd installer in quarantine

2017-07-06 Thread Ecstatic Coder via Digitalmars-d-learn
But no problem with any file stored inside the current .7z archive file. So I guess the problem comes from the installer executable itself. Please try to fix this as soon as possible, as this immediately drives people away from D before they even got a chance to install it...

Re: Need simple sound

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
On Thursday, 6 July 2017 at 14:41:32 UTC, Sebastiaan Koppe wrote: On Thursday, 6 July 2017 at 13:28:26 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: Sure, see http://code.dlang.org/packages/portaudio So, after a bit of work I can get port audio to

Re: [BEGINNER] reccurence! and sequence!

2017-07-06 Thread ag0aep6g via Digitalmars-d-learn
On 07/06/2017 02:21 AM, Ali Çehreli wrote: On 07/05/2017 04:38 PM, helxi wrote: [...] >> recurrence!((a, n) => a[0] + 1)(1).take(10).writeln; > 1. In the last example of reccurence, what does n in (a,n) refer to? n is "the index of the current value". Each time the lambda is called,

Re: Need simple sound

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
On Thursday, 6 July 2017 at 14:41:32 UTC, Sebastiaan Koppe wrote: On Thursday, 6 July 2017 at 13:28:26 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: Sure, see http://code.dlang.org/packages/portaudio So, after a bit of work I can get port audio to

Re: AutoDLL

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
On Thursday, 6 July 2017 at 16:14:18 UTC, Mike Parker wrote: On Thursday, 6 July 2017 at 12:15:57 UTC, FoxyBrown wrote: //pragma(lib, "portaudio_x86.lib"); // Doesn't work because libs are invalid Probably just a OMF/COFF issue. If you try to link with a COFF library while compiling with

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jul 06, 2017 at 06:28:11AM +, unleashy via Digitalmars-d-learn wrote: > Hello. I am trying to compile this: > > --- > module asd.asd; > > abstract class Asd > { > void opCall(Args...)(Args args); > } > > @system unittest > { > class Foo : Asd > { > override void

Re: AutoDLL

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 16:14:18 UTC, Mike Parker wrote: to compile with -m32mscoff MS linker instead. Either that, or *to use* the MS linker

Re: AutoDLL

2017-07-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 July 2017 at 12:15:57 UTC, FoxyBrown wrote: //pragma(lib, "portaudio_x86.lib"); // Doesn't work because libs are invalid Probably just a OMF/COFF issue. If you try to link with a COFF library while compiling with 32-bit DMD in its default configuration on Windows, you'll

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread Arafel via Digitalmars-d-learn
On 07/06/2017 05:11 PM, unleashy wrote: Maybe it was an error on my part for not declaring the function as abstract? My view was that the abstract attribute on a class marks all its members as virtual unless they have a body, which is how it works in, say, Java. Still, kinda odd that the

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread unleashy via Digitalmars-d-learn
On Thursday, 6 July 2017 at 06:48:57 UTC, rikki cattermole wrote: Templates+classes = require function body. Why? Templated methods are not virtual, they are final and cannot be inherited (so its a little strange that the override is valid). Ah well. I would've expected a compiler error,

Re: Need simple sound

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 13:28:26 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: Sure, see http://code.dlang.org/packages/portaudio So, after a bit of work I can get port audio to work but the callback never seems to be called(no audio, never hits

Re: Remove instance from array

2017-07-06 Thread Jolly James via Digitalmars-d-learn
On Thursday, 6 July 2017 at 08:15:10 UTC, Andrea Fontana wrote: On Wednesday, 5 July 2017 at 16:17:29 UTC, Jolly James wrote: On Wednesday, 5 July 2017 at 16:04:16 UTC, Jolly James wrote: [...] Part of CoreCLR's 'List': [...] If there isn't already, maybe something similar to this

Re: dub + local dependencies

2017-07-06 Thread Jolly James via Digitalmars-d-learn
On Thursday, 6 July 2017 at 00:12:25 UTC, Mike Parker wrote: On Thursday, 6 July 2017 at 00:09:46 UTC, Mike Parker wrote: You have a few options: * Use a path dependency: "dependencies": { "xyz": { "path": "path/to/xyz" } } * Use add-local with a version on the command

Re: Need simple sound

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice cross platform. are there any bindings? Sure, see

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread Arafel via Digitalmars-d-learn
Well, it happened to me once [1], and the reason is that templated functions are final by default (since, as you said, it doesn't make sense for them to be anything else). This way the body of the function is assumed to be in a different compilation unit (which is not, hence the linker

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 12:26:11 UTC, Andrea Fontana wrote: I think you should provide a code snippet then. I think I missed something about your question. You did - this question is about a runtime variadic which gives you an array of TypeInfo objects, but all the answers are giving

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 6 July 2017 at 12:15:56 UTC, Hamborg wrote: That compiles, but it returns false when I pass in a numeric value... :( I think you should provide a code snippet then. I think I missed something about your question. Andrea

AutoDLL

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
A DLL Loader prototype that loads DLL's, just specify the declaration. Probably should be worked up so it is easy to load DLL's. Example: import portaudio; import std.conv, std.stdio; import core.stdc.stdio; //pragma(lib, "portaudio_x86.lib"); // Doesn't work because libs are invalid

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Hamborg via Digitalmars-d-learn
On Thursday, 6 July 2017 at 08:35:05 UTC, Andrea Fontana wrote: On Thursday, 6 July 2017 at 08:22:44 UTC, Hamborg wrote: But how would I check _arguments[i]? When I do (isNumeric!_arguments[i]) I get an error saying: "Error: template instance isNumeric!(_arguments) does not match template

Re: Need simple sound

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Thursday, 6 July 2017 at 10:47:53 UTC, FoxyBrown wrote: On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice

Re: Need simple sound

2017-07-06 Thread FoxyBrown via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 07:21:45 UTC, Sebastiaan Koppe wrote: On Wednesday, 5 July 2017 at 05:34:37 UTC, FoxyBrown wrote: On Tuesday, 4 July 2017 at 20:37:44 UTC, Sebastiaan Koppe wrote: Portaudio is simple as well. And nice cross platform. are there any bindings? Sure, see

Re: [BEGINNER] reccurence! and sequence!

2017-07-06 Thread helxi via Digitalmars-d-learn
On Thursday, 6 July 2017 at 00:21:44 UTC, Ali Çehreli wrote: On 07/05/2017 04:38 PM, helxi wrote: >> [...] > > Oh thank you. Just 2 follow-up questions: >> [...] > 1. In the last example of reccurence, what does n in (a,n) refer to? n is "the index of the current value". Each time the lambda

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 6 July 2017 at 08:22:44 UTC, Hamborg wrote: But how would I check _arguments[i]? When I do (isNumeric!_arguments[i]) I get an error saying: "Error: template instance isNumeric!(_arguments) does not match template declaration isNumeric(T)" or when I do

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Hamborg via Digitalmars-d-learn
On Thursday, 6 July 2017 at 07:11:01 UTC, Ali Çehreli wrote: On 07/05/2017 11:26 PM, Hamborg wrote: I can test for exactly what what the args are with (_arguments[i] == typeid(int)) but if I just want to know if it's numeric and can pull it out as a double what should I do? I don't really want

Re: Remove instance from array

2017-07-06 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 16:17:29 UTC, Jolly James wrote: On Wednesday, 5 July 2017 at 16:04:16 UTC, Jolly James wrote: On Wednesday, 5 July 2017 at 15:56:45 UTC, Igor Shirkalin wrote: [...] Thank you! :) But why a containers so complicated in D? [...] Part of CoreCLR's 'List':

Re: Check if a variadic argument is numeric?

2017-07-06 Thread Ali Çehreli via Digitalmars-d-learn
On 07/05/2017 11:26 PM, Hamborg wrote: I can test for exactly what what the args are with (_arguments[i] == typeid(int)) but if I just want to know if it's numeric and can pull it out as a double what should I do? I don't really want to test for int, uint, byte, float, etc individually. If it

Re: Undefined symbol for, apparently, valid code?

2017-07-06 Thread rikki cattermole via Digitalmars-d-learn
On 06/07/2017 7:28 AM, unleashy wrote: Hello. I am trying to compile this: --- module asd.asd; abstract class Asd { void opCall(Args...)(Args args); } @system unittest { class Foo : Asd { override void opCall(Args...)(Args args) { /* nothing */

Undefined symbol for, apparently, valid code?

2017-07-06 Thread unleashy via Digitalmars-d-learn
Hello. I am trying to compile this: --- module asd.asd; abstract class Asd { void opCall(Args...)(Args args); } @system unittest { class Foo : Asd { override void opCall(Args...)(Args args) { /* nothing */ } } Asd a = new Foo();

Check if a variadic argument is numeric?

2017-07-06 Thread Hamborg via Digitalmars-d-learn
I can test for exactly what what the args are with (_arguments[i] == typeid(int)) but if I just want to know if it's numeric and can pull it out as a double what should I do? I don't really want to test for int, uint, byte, float, etc individually.

Re: unittest-cov - results?

2017-07-06 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 19:01:06 UTC, Jonathan M Davis wrote: I ran into a bug in dub not all that long ago where the tests in the module with main in it weren't actually being run even though the other tests were. (which reminds me, I should verify that again and report it). - Jonathan