Re: Anyone using glad?

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 20:48:37 UTC, Dav1d wrote: On Tuesday, 12 January 2016 at 19:16:51 UTC, Jason Jeffory wrote: So, I finally got it to work by abandoning demios and static linking. Derelict + dynamic linking worked with only about a min of problems(copying the proper dll to the cor

Re: Setting up dmd properly

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
On Wednesday, 13 January 2016 at 01:40:59 UTC, Mike Parker wrote: On Tuesday, 12 January 2016 at 21:08:30 UTC, Jason Jeffory wrote: (I should mention that I am exaggerating a bit, and some of the complaints about D are actually more directed to the programming community in general. D has the sa

CAS and atomicOp!"" memory ordering?

2016-01-12 Thread rsw0x via Digitalmars-d-learn
Why is there no way to specify the desired memory order with these? What memory order am I supposed to assume? The documentation is sparse.

mixed-in ctor not on par with explicit one?

2016-01-12 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. Compiling the following code: mixin template intCtor() { this(int i) {} } struct Test { mixin intCtor; this(string s) {} } void main() { auto a = Test("hello"); auto b = Test(1); } ...gives the error: (6): Error: constructor .Test.this (string s) is not callable using argument ty

Re: [Dlang] Delegate Syntax Question

2016-01-12 Thread Jack via Digitalmars-d-learn
On Sunday, 10 January 2016 at 14:32:02 UTC, Jack wrote: Hello. So I was trying to pass a delegate as an argument in a function and was wondering if I'm writing the correct code for it. You see my code is : // class Foo() { void bar() { writeln("He

Re: Setting up dmd properly

2016-01-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 21:08:30 UTC, Jason Jeffory wrote: (I should mention that I am exaggerating a bit, and some of the complaints about D are actually more directed to the programming community in general. D has the same fundamental issues though and it is just a matter of scale. Pro

Re: Anyone using glad?

2016-01-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 19:16:51 UTC, Jason Jeffory wrote: So, I finally got it to work by abandoning demios and static linking. Derelict + dynamic linking worked with only about a min of problems(copying the proper dll to the correct place). Every operating system has a well-defined se

Scale-Hierarchy on ndslice

2016-01-12 Thread Per Nordlöw via Digitalmars-d-learn
Have anybody been thinking about adding a scale-hierarchy structure on top of ndslice? I need this to implementing some cool signal/image processing algorithms in D. When processing an image this structure is called a Mipmap.

Re: Declaring extern(C) declarations with template mixins

2016-01-12 Thread Mathias Lang via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 21:22:46 UTC, Jacob Carlborg wrote: Is this supposed to work: template Foo() { extern(C) int printf(in char*, ...); } mixin Foo; void main() { printf("foo\n"); } It fails with a linker error, undefined symbol, due to not applying C mangling: Undefined

Declaring extern(C) declarations with template mixins

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
Is this supposed to work: template Foo() { extern(C) int printf(in char*, ...); } mixin Foo; void main() { printf("foo\n"); } It fails with a linker error, undefined symbol, due to not applying C mangling: Undefined symbols for architecture x86_64: "__D4main8__mixin76printfUxPaYi"

Re: Setting up dmd properly

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 20:38:50 UTC, Laeeth Isharc wrote: On Tuesday, 12 January 2016 at 19:38:32 UTC, Jason Jeffory wrote: It seems the whole state of affairs in programming is "Lets do the most minimal work to get X to work in environment Y. To hell with everything else!". The program

Re: Setting up dmd properly

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
(I should mention that I am exaggerating a bit, and some of the complaints about D are actually more directed to the programming community in general. D has the same fundamental issues though and it is just a matter of scale. Programming is way more fun when you are actually programming and get

Re: Anyone using glad?

2016-01-12 Thread Dav1d via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 19:16:51 UTC, Jason Jeffory wrote: So, I finally got it to work by abandoning demios and static linking. Derelict + dynamic linking worked with only about a min of problems(copying the proper dll to the correct place). I'd prefer static linking but I can deal with

Re: Setting up dmd properly

2016-01-12 Thread Laeeth Isharc via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 19:38:32 UTC, Jason Jeffory wrote: It seems the whole state of affairs in programming is "Lets do the most minimal work to get X to work in environment Y. To hell with everything else!". The programmers tend to do the most minimal work to code stuff that they can

Re: Setting up dmd properly

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 08:42:19 UTC, Robert M. Münch wrote: On 2016-01-12 04:15:36 +, Mike Parker said: You can avoid all of these headaches by using dynamic bindings like those at DerelictOrg [4] if they are available for the libraries you use. Then the compile-time dependency on

Re: Anyone using glad?

2016-01-12 Thread Jason Jeffory via Digitalmars-d-learn
So, I finally got it to work by abandoning demios and static linking. Derelict + dynamic linking worked with only about a min of problems(copying the proper dll to the correct place). I'd prefer static linking but I can deal with that later. My current problem is: 1. The code doesn't work as e

cast fails for classes from windows dll

2016-01-12 Thread Andre via Digitalmars-d-learn
Hi, I am not sure, whether this is a current limitation of the windows dll functionality of D or I am doing s.th. which will not work. I have developed in D a windows DLL which creates class instances by passing the name (using object.factory method). In another D application I am using thi

Re: Reserved Identifiers (just making sure)

2016-01-12 Thread naptime via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 17:50:45 UTC, Meta wrote: On Tuesday, 12 January 2016 at 16:20:10 UTC, naptime wrote: [...] Yes, symbols in the form of `_Foo` are not reserved in D. Only symbols beginning with two underscores, such as __traits or __gshared. Technically the different `op*` nam

Re: Reserved Identifiers (just making sure)

2016-01-12 Thread Meta via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 16:20:10 UTC, naptime wrote: Hello, I already know the answer to my question, but I would like someone to reassure me that I'm not mistaken before I rename literally hundreds of identifiers in my code (and refactor at least two large templates). TL;DR: Am I

Re: How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 17:03:49 UTC, Ali Çehreli wrote: On 01/12/2016 08:55 AM, ParticlePeter wrote: > I have a function "otherFunc" which takes a function with lots of > parameters as argument: > > void otherFunc( void function( ref int p1, float p2, ubyte p3, ... ) mf ); Ok. > otherF

Re: How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 17:28:35 UTC, Marc Schütz wrote: On Tuesday, 12 January 2016 at 16:55:48 UTC, ParticlePeter wrote: [...] If I understand you correctly (not sure), you would like to write `MF` so that you don't need to specify the parameters in the lambda? That's not possible,

Re: How to declare an alias to a function literal type

2016-01-12 Thread anonymous via Digitalmars-d-learn
On 12.01.2016 17:55, ParticlePeter wrote: When I pass a parameter to otherFunc I use this syntax for an anonymous function parameter: otherFunc( void function( ref int p1, float p2, ubyte p3 ) { myCode; } ); You don't. That's not valid code. You can be using this: otherFunc( function void ( r

Re: How to declare an alias to a function literal type

2016-01-12 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 16:55:48 UTC, ParticlePeter wrote: I can rewrite the definition of otherFunc like this: void otherFunc( MF mf ); But I cannot pass an anonymous function to otherFunc like this: otherFunc( MF { myCode; } ); Thats what I want. Any working example? If I understand

Re: How to declare an alias to a function literal type

2016-01-12 Thread Ali Çehreli via Digitalmars-d-learn
On 01/12/2016 08:55 AM, ParticlePeter wrote: > I have a function "otherFunc" which takes a function with lots of > parameters as argument: > > void otherFunc( void function( ref int p1, float p2, ubyte p3, ... ) mf ); Ok. > otherFunc( void function( ref int p1, float p2, ubyte p3 ) { myCode;

Re: How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 16:22:48 UTC, ParticlePeter wrote: Actually, I do use only one param, and not int as well, hence I would like the parameter list to be part of the alias. Your example works though. This was confusing, lets start fresh: I have a function "otherFunc" which takes

Re: How to declare an alias to a function literal type

2016-01-12 Thread Ali Çehreli via Digitalmars-d-learn
On 01/12/2016 07:41 AM, ParticlePeter wrote: > Please, if possible, also show me where I should have found the answer > (D Reference, Alis book It is not used with a function literal but searching for 'alias' below yields something close: :) http://ddili.org/ders/d.en/lambda.html Function

Re: How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 16:00:37 UTC, Daniel Kozak wrote: V Tue, 12 Jan 2016 15:41:02 + ParticlePeter via Digitalmars-d-learn napsáno: I have a function type and variable and assign a function to it: void function( int i ) myFunc; myFunc = void function( int i ) { myCode; } How w

Re: How to declare an alias to a function literal type

2016-01-12 Thread Ali Çehreli via Digitalmars-d-learn
On 01/12/2016 08:22 AM, ParticlePeter wrote: > On Tuesday, 12 January 2016 at 15:57:03 UTC, Marc Schütz wrote: > Not what I wanted, I wanted the parameter to be part of the alias: > myFunc = MF { ... } > > I want to pass such a function to another function: > > alias MF = void function(int i); >

Reserved Identifiers (just making sure)

2016-01-12 Thread naptime via Digitalmars-d-learn
Hello, I already know the answer to my question, but I would like someone to reassure me that I'm not mistaken before I rename literally hundreds of identifiers in my code (and refactor at least two large templates). TL;DR: Am I understanding correctly that "_Foo" is NOT reserved as an id

Re: How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 15:57:03 UTC, Marc Schütz wrote: On Tuesday, 12 January 2016 at 15:41:02 UTC, ParticlePeter wrote: I have a function type and variable and assign a function to it: void function( int i ) myFunc; myFunc = void function( int i ) { myCode; } How would I declare an

Re: How to declare an alias to a function literal type

2016-01-12 Thread anonymous via Digitalmars-d-learn
On 12.01.2016 16:41, ParticlePeter wrote: // alias MF = void function( int i ); // not working // alias void function( int i ) MF; // not working These are both fine. The first one is the preferred style. MF myFunc; myFunc = MF { myCode }; This line doesn't work. Function literals don't

Re: How to declare an alias to a function literal type

2016-01-12 Thread Daniel Kozak via Digitalmars-d-learn
V Tue, 12 Jan 2016 15:41:02 + ParticlePeter via Digitalmars-d-learn napsáno: > I have a function type and variable and assign a function to it: > > void function( int i ) myFunc; > myFunc = void function( int i ) { myCode; } > > How would I declare an alias for void function( int i ) such t

Re: How to declare an alias to a function literal type

2016-01-12 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 15:41:02 UTC, ParticlePeter wrote: I have a function type and variable and assign a function to it: void function( int i ) myFunc; myFunc = void function( int i ) { myCode; } How would I declare an alias for void function( int i ) such that the case above would w

How to declare an alias to a function literal type

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
I have a function type and variable and assign a function to it: void function( int i ) myFunc; myFunc = void function( int i ) { myCode; } How would I declare an alias for void function( int i ) such that the case above would work like this: // alias MF = void function( int i ); // not work

Re: Anyone using glad?

2016-01-12 Thread ParticlePeter via Digitalmars-d-learn
On Monday, 11 January 2016 at 00:46:38 UTC, Jason Jeffory wrote: ... OK, I'll give it a try. What about GLUT and WGL? Whats the difference between them all and glfw? Are all these just OS helpers to reduce the boilerplate code? These kind of questions are best clarified on the OpenGL wiki. htt

Re: is expression with template parameter list

2016-01-12 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/12/16 8:03 AM, Jacob Carlborg wrote: The following example compiles work as expected: import std.stdio; import std.typecons; void main() { Nullable!(int) a; static if(is(typeof(a) == Nullable!(U), U)) writeln("true"); else writeln("false"); } But if I use

is expression with template parameter list

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
The following example compiles work as expected: import std.stdio; import std.typecons; void main() { Nullable!(int) a; static if(is(typeof(a) == Nullable!(U), U)) writeln("true"); else writeln("false"); } But if I use the fully qualified name in the condition, i.e.

Re: Setting up dmd properly

2016-01-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 12:32:11 UTC, Mike Parker wrote: On Tuesday, 12 January 2016 at 08:42:19 UTC, Robert M. Münch wrote: I have seen countless problems because apps are using dynamic linking and whole IT environements getting into DLL hell. IMO one of the worst ideas these days.

Re: Setting up dmd properly

2016-01-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 08:42:19 UTC, Robert M. Münch wrote: I have seen countless problems because apps are using dynamic linking and whole IT environements getting into DLL hell. IMO one of the worst ideas these days. I'm not talking about dynamic linking, but dynamic loading. This

Re: Setting up dmd properly

2016-01-12 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-01-11 02:22, Jason Jeffory wrote: Dmd's setup construction is a bit weird and has some difficult issue tracking. How about if dmd supported, if it already doesn't, some ways to help the user check the configuration of dmd. It would be quick and easy to implement. e.g., dmd -showinfo T

Re: Setting up dmd properly

2016-01-12 Thread Robert M. Münch via Digitalmars-d-learn
On 2016-01-12 04:15:36 +, Mike Parker said: You can avoid all of these headaches by using dynamic bindings like those at DerelictOrg [4] if they are available for the libraries you use. Then the compile-time dependency on the C library goes away and all you need is the DLL at runtime. I