Re: How to get array length

2014-05-25 Thread kaz via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:24:30 UTC, Brad Anderson wrote: On Thursday, 22 May 2014 at 23:22:44 UTC, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. Just use .length: void main() { import std.stdio; auto a = new int[5];

Re: How to get array length

2014-05-25 Thread kaz via Digitalmars-d-learn
On Thursday, 22 May 2014 at 23:26:02 UTC, Ali Çehreli wrote: On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the length of the slice is trivial: slice.length. The

How to declare a library .dll to import functions?

2014-05-25 Thread Andrey via Digitalmars-d-learn
Hi, guys I have translated some (infact, almost all) Oracle headers to D. E.g. this: extern(C): sword OCINumberSub(OCIError *err, const OCINumber *number1, const OCINumber *number2, OCINumber *result); The problem is, that D's linger cannot link all this stuff

Re: Creating ranges over mutable, const, or immutable data structures.

2014-05-25 Thread Ali Çehreli via Digitalmars-d-learn
On 05/24/2014 10:02 AM, w0rp wrote: Create a mutable KeyRange over a map which forwards on the right constness for the key type, so the following must be true. HashMap!(K, V).keys.front - K const(HashMap!(K, V)).keys.front - const(K) immutable(HashMap!(K, V)).keys.front - immutable(K) I

Re: How to declare a library .dll to import functions?

2014-05-25 Thread Kagamin via Digitalmars-d-learn
If it's for 32-bit windows, convert oci import libraries to omf.

Re: How to declare a library .dll to import functions?

2014-05-25 Thread Kagamin via Digitalmars-d-learn
http://forum.dlang.org/thread/dpaolp$1oek$1...@digitaldaemon.com

Re: How to declare a library .dll to import functions?

2014-05-25 Thread Andrey via Digitalmars-d-learn
On Sunday, 25 May 2014 at 08:12:26 UTC, Kagamin wrote: http://forum.dlang.org/thread/dpaolp$1oek$1...@digitaldaemon.com Finally it works! Thank you! Does anybody need these headers?

Re: Programming a Game in D? :D

2014-05-25 Thread Dmitry via Digitalmars-d-learn
On Saturday, 24 May 2014 at 18:00:05 UTC, evilrat wrote: there is a plugin for linux for GDB i believe, and another plugin for Windows which i can't remember the name, the latter one disappeared from XS 5.0 by some reason. search the extensions for it. I use Windows. Thanks, I think I found

Re: How to get array length

2014-05-25 Thread Rene Zwanenburg via Digitalmars-d-learn
On Sunday, 25 May 2014 at 06:50:14 UTC, kaz wrote: On Thursday, 22 May 2014 at 23:26:02 UTC, Ali Çehreli wrote: On 05/22/2014 04:22 PM, kaz wrote: Is there a way to get the length of an array out of slice bracket in D? Tks. If you mean the length of the original array, no. Of course, the

Re: How to debug ?

2014-05-25 Thread Rene Zwanenburg via Digitalmars-d-learn
On Saturday, 24 May 2014 at 15:48:11 UTC, Derix wrote: To debug you nee to use -g flag to compiler Thanks, but how ? I don't use Eclipse, but for debugging you usually have to do two things. As mentioned before you need to have debug information in the executable. Dub will generate debug

Re: Programming a Game in D? :D

2014-05-25 Thread evilrat via Digitalmars-d-learn
On Sunday, 25 May 2014 at 08:59:55 UTC, Dmitry wrote: On Saturday, 24 May 2014 at 18:00:05 UTC, evilrat wrote: there is a plugin for linux for GDB i believe, and another plugin for Windows which i can't remember the name, the latter one disappeared from XS 5.0 by some reason. search the

Passing a function as an argument to another function : what is this sorcery ?

2014-05-25 Thread Derix via Digitalmars-d-learn
Hello everyone, So I'm Getting Started With Gtkd [1] and the tuto includes this piece of code : ... DrawingArea da = new DrawingArea(590, 200); da.addOnDraw(onDraw); layout.put(da, 5, 30); add(layout); // Add the layout to our main window showAll(); }

Re: Programming a Game in D? :D

2014-05-25 Thread evilrat via Digitalmars-d-learn
On Sunday, 25 May 2014 at 08:59:55 UTC, Dmitry wrote: I use Windows. Thanks, I think I found it: https://github.com/llucenic/MonoDevelop.Debugger.Gdb.D But now I cant install it, here is error: The package 'MonoDevelop.Core v4.0' could not be found in any repository The package

Re: Passing a function as an argument to another function : what is this sorcery ?

2014-05-25 Thread Ali Çehreli via Digitalmars-d-learn
On 05/25/2014 02:37 AM, Derix wrote: DrawingArea da = new DrawingArea(590, 200); da.addOnDraw(onDraw); layout.put(da, 5, 30); add(layout); // Add the layout to our main window showAll(); } bool onDraw(Context c, Widget w) {

Re: Passing a function as an argument to another function : what is this sorcery ?

2014-05-25 Thread Rikki Cattermole via Digitalmars-d-learn
On 25/05/2014 9:37 p.m., Derix wrote: Hello everyone, So I'm Getting Started With Gtkd [1] and the tuto includes this piece of code : ... DrawingArea da = new DrawingArea(590, 200); da.addOnDraw(onDraw); layout.put(da, 5, 30); add(layout); // Add the layout

Re: Passing a function as an argument to another function : what is this sorcery ?

2014-05-25 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 25 May 2014 at 09:37:46 UTC, Derix wrote: Hello everyone, So I'm Getting Started With Gtkd [1] and the tuto includes this piece of code : ... DrawingArea da = new DrawingArea(590, 200); da.addOnDraw(onDraw); layout.put(da, 5, 30); add(layout); // Add

Is there any way to differentiate between a type and an alias?

2014-05-25 Thread Rene Zwanenburg via Digitalmars-d-learn
Given alias GLenum = uint; void glSomeFunction(GLenum, uint); Now, is there some way to differentiate between GLenum and uint when using ParameterTypeTuple!glSomeFunction? I'm writing a function which shows the arguments a GL function was called with when an error occurs. The GLenum needs

Re: Programming a Game in D? :D

2014-05-25 Thread Dmitry via Digitalmars-d-learn
On Sunday, 25 May 2014 at 09:44:18 UTC, evilrat wrote: sorry, forgot to add - Mono-D is moving to XS 5.0 (alpha), so if XS 4.0 not working for you, try to switch on alpha channel updates. on the contrary, I have now XS 5.0 and I have a reply: aBothe commented an hour ago It's not there for

Re: Is there any way to differentiate between a type and an alias?

2014-05-25 Thread Damian Day via Digitalmars-d-learn
On 25/05/2014 12:04, Rene Zwanenburg wrote: Given alias GLenum = uint; void glSomeFunction(GLenum, uint); Now, is there some way to differentiate between GLenum and uint when using ParameterTypeTuple!glSomeFunction? I'm writing a function which shows the arguments a GL function was called

Re: Is there any way to differentiate between a type and an alias?

2014-05-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On Sun, 25 May 2014 04:04:09 -0700, Rene Zwanenburg renezwanenb...@gmail.com wrote: Given alias GLenum = uint; void glSomeFunction(GLenum, uint); Now, is there some way to differentiate between GLenum and uint when using ParameterTypeTuple!glSomeFunction? I'm writing a function which

TDPL - Andrei Alexandrescu

2014-05-25 Thread DLearner via Digitalmars-d-learn
Does the current D specification differ from that used in the book (and, if it does, is there a link to the changes)?

Re: TDPL - Andrei Alexandrescu

2014-05-25 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 25 May 2014 at 15:07:56 UTC, DLearner wrote: Does the current D specification differ from that used in the book (and, if it does, is there a link to the changes)? http://erdani.com/tdpl/errata/

installing Mango with DMD instead of ldc

2014-05-25 Thread JJDuck via Digitalmars-d-learn
Hello all, I tried to install Mango and I found that it requires ldc. the makefile for Mango is from http://svn.dsource.org/projects/mango/trunk/mango/build/ldc/makefile I tried to install ldc on Windows but it doesn't go very smooth for the whole weekend, so I decide to try to install Mango

Re: installing Mango with DMD instead of ldc

2014-05-25 Thread John Colvin via Digitalmars-d-learn
On Sunday, 25 May 2014 at 18:11:56 UTC, JJDuck wrote: Hello all, I tried to install Mango and I found that it requires ldc. the makefile for Mango is from http://svn.dsource.org/projects/mango/trunk/mango/build/ldc/makefile I tried to install ldc on Windows but it doesn't go very smooth for

Building and using a function library

2014-05-25 Thread Charles Parker via Digitalmars-d-learn
What does this error mean? ./min_cut.d(15): Error: module line_count from file ../my_utils/line_count.d must be imported as module 'line_count' My directory structure in question is: .../D /min_cut which contains min_cut.d which I'm building /my_utils which contains line_count.d

Re: Building and using a function library

2014-05-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 25 May 2014 at 19:07:10 UTC, Charles Parker wrote: ./min_cut.d(15): Error: module line_count from file ../my_utils/line_count.d must be imported as module 'line_count' That means you forgot the module line in line_count.d At the top of that file, add: module my_utils.line_count;

Re: Building and using a function library

2014-05-25 Thread Charles Parker via Digitalmars-d-learn
On Sunday, 25 May 2014 at 19:14:05 UTC, Adam D. Ruppe wrote: On Sunday, 25 May 2014 at 19:07:10 UTC, Charles Parker wrote: ./min_cut.d(15): Error: module line_count from file ../my_utils/line_count.d must be imported as module 'line_count' That means you forgot the module line in

Re: Is there any way to differentiate between a type and an alias?

2014-05-25 Thread Rene Zwanenburg via Digitalmars-d-learn
On Sunday, 25 May 2014 at 14:40:06 UTC, Steven Schveighoffer wrote: On Sun, 25 May 2014 04:04:09 -0700, Rene Zwanenburg renezwanenb...@gmail.com wrote: Given alias GLenum = uint; void glSomeFunction(GLenum, uint); Now, is there some way to differentiate between GLenum and uint when using

Re: Programming a Game in D? :D

2014-05-25 Thread MrSmith via Digitalmars-d-learn
Also opengl tutorials for D https://github.com/d-gamedev-team/opengl-tutorials

next!T

2014-05-25 Thread Andrew Edwards via Digitalmars-d-learn
Hello All, I wrote the following convenience functions to aid in my studies. Unfortunately, I'm using Java books (Ali I will get to yours soon enough) so the need was necessitated by the frequency of use in the examples. Would appreciate a sanity check. Is there something that I should be

Re: next!T

2014-05-25 Thread Ali Çehreli via Digitalmars-d-learn
On 05/25/2014 05:21 PM, Andrew Edwards wrote: Hello All, I wrote the following convenience functions to aid in my studies. Unfortunately, I'm using Java books (Ali I will get to yours soon enough) so the need was necessitated by the frequency of use in the examples. Would appreciate a sanity