Re: `static` symbol needs to be `immutable` for compile-time access?

2016-01-22 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 January 2016 at 09:56:27 UTC, Shriramana Sharma wrote: In C/C++ the `static` here is used to avoid the array being created every time the function is entered; in D too it does the same thing, no? So if I have an array of constants in a function that I need to be accessible to a

Re: Disabling GC in D

2016-01-21 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 21 January 2016 at 23:06:55 UTC, Dibyendu Majumdar wrote: On Thursday, 21 January 2016 at 22:44:14 UTC, H. S. Teoh wrote: Hi - I want to be sure that my code is not allocating memory via the GC allocator; but when shipping I don't need to disable GC - it is mostly a development che

Re: Linking C libraries with DMD

2016-01-21 Thread Mike Parker via Digitalmars-d-learn
I've take your example, modified it slightly, compiled the DLL with Visual Studio, and got a working executable. Firs up, the C file. Here's your original: clib.c #include int some_c_function(int); int some_c_function(int a) { printf("Hello, D! from C! %d\n", a);

Re: Linking C libraries with DMD

2016-01-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 January 2016 at 02:39:33 UTC, jmh530 wrote: The LearningD book says that you should compile the libraries with DMC on Windows, but I can't figure out how to generate a shared library on DMC. I didn't get the implib error for what I was working on before. I feel like getting s

Re: Doubt - Static multidimension arrays

2016-01-19 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 14:58:51 UTC, tsbockman wrote: Anyway, I'll give it a rest now. I thought this way of looking at it would make things easier to understand, but I guess not... In my experience, it's focusing on the types in the D array syntax, rather than the actual ordering, th

Re: Doubt - Static multidimension arrays

2016-01-19 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 08:27:56 UTC, tsbockman wrote: The only relevant difference between the two, is that the order of the row and column specification is swapped in *the declaration*, not when indexing. Newcomers to D tend to think in terms of C when they declare arrays, so the co

Re: Doubt - Static multidimension arrays

2016-01-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 07:32:22 UTC, tsbockman wrote: That's because you're stuck in the mindset that 2d arrays are somehow *special*. If I do this: It's not that he's seeing them as special, it's just that indexing them in D is different than doing so in C or C++. It trips a lot

Re: Doubt - Static multidimension arrays

2016-01-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 January 2016 at 07:21:39 UTC, albert00 wrote: On Tuesday, 19 January 2016 at 04:50:18 UTC, tsbockman wrote: On Tuesday, 19 January 2016 at 03:20:30 UTC, albert00 wrote: [...] ... what you're making is an array *of arrays*: Maybe I was misunderstood, because in fact that is wh

Re: DUB - link error on Windows 10 64-bit

2016-01-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 January 2016 at 21:51:15 UTC, Dibyendu Majumdar wrote: Well as far as I can tell they are correct (unchanged from whatever the installer set them to): ; environment for both 32/64 bit [Environment] DFLAGS="-I%@P%\..\..\src\phobos" "-I%@P%\..\..\src\druntime\import" ; optl

Re: DUB - link error on Windows 10 64-bit

2016-01-16 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 January 2016 at 02:48:47 UTC, Mike Parker wrote: On Saturday, 16 January 2016 at 20:28:02 UTC, Dibyendu Majumdar wrote: I have installed DMD by unzipping the DMD archive (The installer does not work correctly on Windows 10). DUB installed as normal. What problem did you have

Re: DUB - link error on Windows 10 64-bit

2016-01-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 January 2016 at 20:28:02 UTC, Dibyendu Majumdar wrote: I have installed DMD by unzipping the DMD archive (The installer does not work correctly on Windows 10). DUB installed as normal. What problem did you have with the installer? Which version? I've installed DMD more tha

Re: DUB & Win-10 SDK / link lib not found

2016-01-14 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 14 January 2016 at 22:13:37 UTC, Robert M. Münch wrote: Seems that some paths in sc.ini were not setup correctly. For x64 a Win10-SDK directory which doesn't exists was referenced. Did you install DMD manually? In that case, you will usually need to edit sc.ini to point to the

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

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-11 Thread Mike Parker via Digitalmars-d-learn
On Monday, 11 January 2016 at 16:27:54 UTC, Jason Jeffory wrote: Anyway, regarding the static libs. I used this on a Win64 project and it works: "lflags" : [ "D:\\develop\\cairo\\cairo\\src\\release\\cairo-static.lib", "D:\\develop\\cairo\\libpng\\libpng.lib",

Re: LINK : fatal error LNK1104: cannot open file '_CMDLINE' --- errorlevel 1104

2016-01-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 03:47:35 UTC, Mike Parker wrote: On Tuesday, 12 January 2016 at 01:44:17 UTC, Jason Jeffory wrote: So, how do I set the json to compile for x64? You don't. You pass -ax86_64 (or --arch=x86_64) on the command line. If you find that inconvenient, just make a bat

Re: LINK : fatal error LNK1104: cannot open file '_CMDLINE' --- errorlevel 1104

2016-01-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 03:52:33 UTC, Mike Parker wrote: Actually, you could add -m64 in a dflags field (see [1]), but then you're in a situation where DUB thinks you're compiling in 32-bit, so configuration fields that are architecture-dependent will be off. [1] http://code.dlang.or

Re: LINK : fatal error LNK1104: cannot open file '_CMDLINE' --- errorlevel 1104

2016-01-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 January 2016 at 01:44:17 UTC, Jason Jeffory wrote: So, how do I set the json to compile for x64? You don't. You pass -ax86_64 (or --arch=x86_64) on the command line. If you find that inconvenient, just make a batch file to do it for you.

Re: LINK : fatal error LNK1104: cannot open file '_CMDLINE' --- errorlevel 1104

2016-01-11 Thread Mike Parker via Digitalmars-d-learn
On Monday, 11 January 2016 at 20:19:50 UTC, Jason Jeffory wrote: On Monday, 11 January 2016 at 20:17:23 UTC, Jason Jeffory wrote: Any ideas? Happens when I do a very simple dub project and try to compile using the MS linker(x86 but set in sc.ini or 64). I'm linking in glfw(using correct arch of

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 10 January 2016 at 05:47:01 UTC, WhatMeWorry wrote: Thanks. Bummer. I really like gl3n, but glm/opengl is used almost exclusively in all the modern opengl code (tutorials) I've seen, so this might be a deal breaker. As the author of Derelict do you have any ideas of how much work i

Re: issue porting C++/glm/openGL to D/gl3n/openGL

2016-01-09 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote: Is gl3n not a direct replacement for glm? From the very top of the gl3n github page: "OpenGL Maths for D (not glm for D)." So, no, it is not. You might want to start with the glm documentaion [1]. [1] http://dav1dde.github

Re: How to use GDC to get .a file on Linux?

2015-12-27 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 27 December 2015 at 15:19:21 UTC, FrankLike wrote: Hi, Now I need get the .a file on Linux,target system is ARM. If you use gcc ,you will use the 'ar' to get .a file, but how to do by GDC ? And how to get the execute file by .a file and .d file? Thank you. Just use ar on the

Re: AliasSeq can contain template identifier too?

2015-12-12 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 12 December 2015 at 14:15:37 UTC, Shriramana Sharma wrote: https://github.com/D-Programming-Language/phobos/blob/master/std/meta.d#L790 Looks like an AliasSeq can contain a template identifier too. So should I understand that AliasSeq in general can refer to any identifier and any

Re: Very very noobie question about how imports work.

2015-12-11 Thread Mike Parker via Digitalmars-d-learn
On Friday, 11 December 2015 at 03:51:35 UTC, tcak wrote: In D, directory structure doesn't matter. What matters is module names. Actually, it does matter sometimes. // src/foo/bar.d module foo.oops; // main.d import foo.oops; void main() {} Compile: dmd -Isrc main.d Result: main.d(1): Erro

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:46:19 UTC, Suliman wrote: because set return void, and get return T? No, it has nothing to do with the return type declarations. It's about whether or not the compiler has enough information to deduce the types. V get(V, K)(K key, V defaultVal); auto i

Re: How to return user name from vibed session?

2015-12-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 December 2015 at 13:23:29 UTC, Suliman wrote: But question about why I need to get session info like: writeln("USER Session: ", req.session.get!string("username")); is still actual. When you have a template that looks like this: V get(V, K)(K key) {...} The compiler is abl

Re: Comparison operator overloading

2015-12-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 December 2015 at 11:49:51 UTC, Dominikus Dittes Scherkl wrote: On Sunday, 6 December 2015 at 15:01:08 UTC, cym13 wrote: Don't use opCmp, all binary operators should be overriden using opBinary. For more information I recommend this page http://ddili.org/ders/d.en/operator_overloadi

Re: Are selective imports supposed to always be public?

2015-12-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 December 2015 at 10:31:58 UTC, tsbockman wrote: Why does this code compile? Shouldn't the `isIntegral` import be private to module `testB` unless I explicitly ask for it to be public? // testB.d module testB; import std.traits : isIntegral; // testA.d module testA; void main(st

Re: Struct initializers as expressions

2015-12-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 December 2015 at 10:42:46 UTC, Marc Schütz wrote: ; Then we can add some syntax sugar to leave out the braces, too: void bar(int a, T t) bar(42, a: "bla", b: "xyz"); This effectively gives us strongly typed named arguments, without making the names part of the function si

Re: Struct initializers as expressions

2015-12-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 December 2015 at 05:26:17 UTC, Chris Wright wrote: I can initialize a struct with named values: --- struct Foo { int i, j, k, l, m, n; } Foo f = {k: 12}; // other fields get default initialization --- I can initialize it with call syntax: --- auto f = Foo(0, 0, 12, 0, 0, 0);

Re: Classes as enums in D?

2015-11-30 Thread Mike Parker via Digitalmars-d-learn
On Monday, 30 November 2015 at 07:58:43 UTC, Andrew LaChance wrote: Oh interesting. So you are saying I could have a struct WhiteKey {...} and then an enum that extends WhiteKey? enums can't *extend* anything. You can do this: struct WhiteKeyS { immutable int halfStepsToPrevious;

Re: Derelict GLFW3 glfw3.dll error

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote: import std.stdio; import derelict.opengl3.gl3; import derelict.glfw3.glfw3; pragma(lib, "C:\\Users\\Alexander\\AppData\\Roaming\\dub\\packages\\derelict-gl3-1.0.17\\lib\\DerelictGL3"); pragma(lib, "C:\\Users\\Alexander\\AppData\\Roa

Re: Derelict GLFW3 glfw3.dll error

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 22:58:20 UTC, Alexander wrote: ERROR: "derelict.util.exception.SharedLibLoadException@..\..\AppData\Roaming\dub\packages\derelict-util-2.0.4\source\derelict\util\exception.d(35): Failed to load one or more shared libraries: glfw3.dll - The specified module

Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 09:24:47 UTC, Alexander wrote: On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole Ah ok! so here's my updated code. I still get the object error. I am trying to get a blank window to appear. I call the reload after I set the glfwcontext. I'm not su

Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 16:20:47 UTC, Mike Parker wrote: On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole wrote: When you activate an OpenGL context you reload it. You do not do this when one is not activated. Doing so shouldn't cause an access violation, though. It wou

Re: Derelict3 object.Error@(0): Access Violation?

2015-11-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 November 2015 at 07:53:09 UTC, Rikki Cattermole wrote: When you activate an OpenGL context you reload it. You do not do this when one is not activated. Doing so shouldn't cause an access violation, though. It would be throwing a DerelictException saying that no context has be

Re: D equivalent of Python's try..else

2015-11-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 21 November 2015 at 13:57:01 UTC, Shriramana Sharma wrote: Hmm – I forgot Python has `else` for `for` and `while` too. But it's a tad difficult to wrap one's mind around the meaning of the word `else` in this particular context whereas it actually means `nobreak`. Perhaps if this

Re: on structs by reference

2015-11-14 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 14 November 2015 at 10:46:57 UTC, Alex wrote: Hi everybody, I have the following question about "by reference" behavior related to structs. I have a struct, say S, which contains a member of reference type struct S { int[] member; } and I have a main, for testing: void mai

Re: win32 from master: unicode functions by default?

2015-11-12 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 November 2015 at 15:58:53 UTC, Jonathan M Davis wrote: On Thursday, November 12, 2015 05:08:24 Mike Parker via version=Unicode on the compiler command line. It seems pretty wrong for the A versions to be the default though... Still, even in C++ code, I've generally taken t

Re: win32 from master: unicode functions by default?

2015-11-11 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 November 2015 at 04:58:42 UTC, Andre wrote: Hi, by using the win32 library from master, the functions aliases to the ansi windows functions (...A) instead of the unicode functions (...W). Is there a way to control this behavior beside using the explicit function names (A/W)?

Re: Error: no property "someFont" for type int

2015-11-10 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 11 November 2015 at 06:37:44 UTC, Marco de Wild wrote: In directory.d: using style; This is not D. It should be giving you a compiler error. How are you compiling? Or did you type 'using' in the post by mistake? Anyway, what you want is: import style; In style.d: module

Re: Error: no property "someFont" for type int

2015-11-10 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 11 November 2015 at 07:46:31 UTC, Mike Parker wrote: Text is from the module dsfml.text.graphics, it has an enum And of course, I meant dsfml.graphics.text.

Re: opCmp with structs

2015-11-07 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 7 November 2015 at 11:48:56 UTC, Alex wrote: So my general question is: why immutable variables shouldn't be able to be moved (inside an array)? To be pedantic, sort isn't actually moving anything. It's reassigning elements, i.e. a[1] = a[2]. The immutable member makes it ille

Re: question about using std.bitmanip.read

2015-11-06 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 7 November 2015 at 03:19:44 UTC, Charles wrote: I went to std.bitmanip to look for unittests using the Endian, and the only one that does uses read!(T, endianness), which needs endianness to be known at compile time, which I don't have. Missed this in my previous reply.

Re: question about using std.bitmanip.read

2015-11-06 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 7 November 2015 at 03:19:44 UTC, Charles wrote: Hi guys, It's me again... still having some issues pop up getting started, but I remain hopeful I'll stop needing to ask so many questions soon. I'm trying to use std.bitmanip.read; however, am having some issues using it. For bas

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 31 October 2015 at 05:33:08 UTC, Timoses wrote: On Saturday, 31 October 2015 at 04:00:18 UTC, Timoses wrote: Linking... ld: library not found for -levent clang: error: linker command failed with exit code 1 (use -v to see invocation) --- errorlevel 1 dmd failed with exit code 1.

Re: Failed 'dub run' with 'Failed to invoke the compiler dmd'

2015-10-30 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 31 October 2015 at 03:00:46 UTC, Timoses wrote: Hey, just getting started with D. I wanted to try out Vibelog. However, when trying to run dub run I receive the error: Failed to invoke the compiler dmd to determine the build platform: /bin/sh: dmd: command not found I'm on O

Re: What's wrong in this templatized operator overload ?

2015-10-21 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 22 October 2015 at 03:19:49 UTC, MobPassenger wrote: code: --- struct Foo { bool opIn_r(T)(T t){return false;} } This needs to be marked with const: struct Foo { bool opIn_r(T)(T t) const {return false;} }

Re: foreach loop

2015-10-19 Thread Mike Parker via Digitalmars-d-learn
On Monday, 19 October 2015 at 15:56:00 UTC, Namal wrote: Is it possible to use foreach backwards? foreach(int i;20..1) writeln(i); compiles but I get nothing. foreach_reverse(i; 1 .. 20) writeln(i); Or: import std.range : iota, retro; foreach(i; iota(1, 20).retro) writeln(i); But

Re: kxml and dub package manager.

2015-10-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 19 October 2015 at 03:33:18 UTC, holo wrote: ok i fugure out it. When i do initiation i need to add dependencies (thought it is enough to add them to sdl file). Proper initiation should look like that: dub init projectname kxml No, you should never need to do that. I think your pr

Re: Why can't function expecting immutable arg take mutable input?

2015-10-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 October 2015 at 10:35:23 UTC, Shriramana Sharma wrote: Hello. I still haven't wrapped my mind around the const/immutable thing yet and am still stuck in C/C++ mode. :-( A function that takes mutable arguments cannot be called with immutable input at the call site since it does no

Re: Strange behavior of array

2015-10-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 October 2015 at 07:25:16 UTC, Jonathan M Davis wrote: That does work currently, but there's talk off and on about deprecating the C syntax, so that may happen at some point, just like the C function pointer syntax was deprecated. Regardless, using the C array declaration synta

Re: Builtin array and AA efficiency questions

2015-10-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 15 October 2015 at 21:48:29 UTC, Random D user wrote: An array uses a block marked for appending, assumeSafeAppend simply sets how much data is assumed to be valid. Calling assumeSafeAppend on a block not marked for appending will do nothing except burn CPU cycles. So yours is n

Re: Strange behavior of array

2015-10-15 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 October 2015 at 03:01:12 UTC, VlasovRoman wrote: Oh, thank you. Some strange solution. D doesn't have multidimensional built-in arrays, but rectangular arrays. Think of it this way: int[3] a1; a1 is a static array of 3 ints. Indexing it returns an int. We can think of it lik

Re: problem with exceptions

2015-10-02 Thread Mike Parker via Digitalmars-d-learn
On Friday, 2 October 2015 at 11:44:21 UTC, steven kladitis wrote: C:\d\examples>pb2 =>main's first line =>makeOmelet's first line =>prepareAll's first line =>prepareEggs's first line object.Exception@pb2.d(64): Cannot take -8 eggs from the fridge 0x00402252 0x0040512F

Re: final class & final methods

2015-09-25 Thread Mike Parker via Digitalmars-d-learn
On Friday, 25 September 2015 at 10:28:56 UTC, ref2401 wrote: If I declare a class as `final` do I have to mark all methods of the class as `final` too? A final class can't be subclassed, so none of its methods can be overridden anyway.

Re: I can't get passing an array by reference to work anymore...

2015-09-24 Thread Mike Parker via Digitalmars-d-learn
On Friday, 25 September 2015 at 02:37:22 UTC, TheGag96 wrote: What's the problem here? I SWEAR I've passed arrays by reference before just like this. Thanks guys. I'm seeing the same error, but I haven't yet determined why. At any rate, this works: ``` import std.stdio; void append(ref int[

Re: Unexpected behavior when casting away immutable

2015-09-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 11:38:38 UTC, Mafi wrote: On Wednesday, 23 September 2015 at 05:24:05 UTC, John Colvin wrote: On Wednesday, 23 September 2015 at 03:39:02 UTC, Mike Parker wrote: ... ``` immutable int x = 10; int* px = cast(int*)&x; *px = 9; writeln(x); ``` It prints 10, wh

Re: Unexpected behavior when casting away immutable

2015-09-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 03:50:44 UTC, Vladimir Panteleev wrote: On Wednesday, 23 September 2015 at 03:39:02 UTC, Mike Parker wrote: ``` immutable int x = 10; int* px = cast(int*)&x; *px = 9; writeln(x); ``` It prints 10, where I expected 9. This is on Windows. I'm curious if anyone

Unexpected behavior when casting away immutable

2015-09-22 Thread Mike Parker via Digitalmars-d-learn
I have a situation where I would like to demonstrate violating the contract of immutable (as an example of what not to do), but do so without using structs or classes, just basic types and pointers. The following snippet works as I would expect: ``` immutable int i = 10; immutable(int*) pi = &

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 September 2015 at 02:58:21 UTC, WhatMeWorry wrote: For my D programming I use the Visual D Studio package (plug-in?) with the "free Visual Studio Shell (2013). I download Visual Studio Express 2015 and used the FreeType 2.6 solution file. (So no makefile). I tried making both

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-19 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 September 2015 at 15:01:06 UTC, WhatMeWorry wrote: Sorry, meant to get back but got busy. Yes, works great! Thanks! Not sure why I had so much trouble finding a freetype.dll library. Had no problems with OpenAL and FreeImage. I'm curious how you compiled the DLL that fail

Re: Anybody use Derelict FreeType recently (successfully)

2015-09-16 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 17 September 2015 at 04:58:05 UTC, WhatMeWorry wrote: Compiling and linking was error free, but when I hit DerelictFT.load(); my program aborts with the following run time message: derelict.util.exception.SymbolLoadException@source\derelict\util\exception.d(35): Failed to load s

Re: Version for windows/console compilation?

2015-09-11 Thread Mike Parker via Digitalmars-d-learn
On Friday, 11 September 2015 at 04:30:44 UTC, Prudence wrote: I'm simply creating my own version flags in VD properties. Not the best way because I'll have to remember to set the flags every time I use the library or I'll get errors about stuff missing. I was hoping D had a flag to disambigua

Re: Version for windows/console compilation?

2015-09-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 September 2015 at 18:10:43 UTC, Adam D. Ruppe wrote: BTW it is pretty rare that you should actually write a WinMain in D. The right thing to do in most cases is to write a normal main function. You can still get the windows gui subsystem with a linker flag. Specifically, add

Re: C++ Interop -- Two Questions

2015-09-09 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 11:49:33 UTC, Kagamin wrote: Static functions are declared with `static` storage class. This looks so basic, it's even not documented in language spec, lol. Yes, I get that. But how does that work when you're linking to a C++ library and the translation of t

C++ Interop -- Two Questions

2015-09-09 Thread Mike Parker via Digitalmars-d-learn
Given a C++ class that looks like this: class Foo { static void Initialize(const SomeObject&); virtual void func1(); } The documentation at [1] doesn't say anything about how to handle static member functions like Initialize, nor do I see anything about references. I assume I can declar

Re: C++ Interop -- Two Questions

2015-09-09 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 09:55:21 UTC, Mike Parker wrote: The documentation at [1] doesn't say anything about how to [1] http://dlang.org/cpp_interface.html

Re: Windows Header consts

2015-09-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 September 2015 at 22:02:47 UTC, Prudence wrote: Again, it's called progress. Why keep using the same defunct system for endless years simply because that's the way it was done? Any C library binding should maintain the same interface as the C library as much as possible. That w

Re: Can we get a video tutorial?

2015-09-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 September 2015 at 19:13:35 UTC, Stephen wrote: On Wednesday, 2 September 2015 at 01:15:28 UTC, Mike Parker wrote: * What was previously said * Ok, so, I am running Windows 10, I have installed VS 2015, I have installed DMD 1 and 2 (I know I only need 2 but it shouldn't hurt to

Re: Casting away immutability

2015-09-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 September 2015 at 13:28:54 UTC, Sergei Degtiarev wrote: Agree, however, memory obtained with mmap(..., PROT_READ, ..); is essentially read-only and any attempt to write to it will cause immediate crash with segmentation violation. It would be very desirable in this case to retu

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:28:52 UTC, Uranuz wrote: As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without using save (it happens even in Phobos). Is it correct behaviour to *

Re: Can we get a video tutorial?

2015-09-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 15:01:15 UTC, Stephen wrote: On Tuesday, 1 September 2015 at 14:50:53 UTC, cym13 wrote: On Tuesday, 1 September 2015 at 14:48:55 UTC, Stephen wrote: So I've been trying to install Dlang, VisualD, and Dub for the past day with little luck. I have DMD 1 and 2, and

Re: Access Violation while trying to use OpenGL

2015-09-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 20:35:43 UTC, spec00 wrote: On Tuesday, 1 September 2015 at 20:15:28 UTC, spec00 wrote: I'am trying to play a bit with D and OpenGL by using the available Derelict bindings, but i'am even failing to create a window. [...] The problem was in me using the 64bit

Re: Array initialization with Struct templates

2015-08-31 Thread Mike Parker via Digitalmars-d-learn
On Monday, 31 August 2015 at 05:47:31 UTC, Ali Çehreli wrote: On 08/30/2015 10:38 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, August 31, 2015 04:57:05 WhatMeWorry via Digitalmars-d-learn wrote: This seemingly trivial array initialization has caused me hours of grief. enum

Re: linking-in libs under linux needed and not under windows

2015-08-26 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 27 August 2015 at 03:17:57 UTC, BBasile wrote: On Thursday, 27 August 2015 at 02:50:58 UTC, BBasile wrote: So the Q: Is this difference normal ? the win OMF & linux COFF "thing" maybe ? If I understand your problem description correctly, the culprit is likely the order in which

Re: __traits(allMembers) and aliases

2015-08-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 11:20:40 UTC, Meta wrote: I've been doing work on this recently. As far as I can tell, there is no way to do this. The problem is that an alias behaves exactly like the thing being aliased since it's just a name replacement, so there are no giveaways like being u

Re: __traits(allMembers) and aliases

2015-08-26 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 16:08:48 UTC, Rikki Cattermole wrote: \> While my memory especially at 4am is rusty here: enum isVarDecl = __traits(compiles, {mixin(GOT ~ " got;");}); Where GOT is assumed to be the string that you got from __traits(allMembers. It'll be true that it is a variabl

Re: __traits(allMembers) and aliases

2015-08-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 25 August 2015 at 12:48:12 UTC, Dejan Lekic wrote: It is off-topic (sorry for that), but how you grab only those (say functions) in a module that are annotated with @ChoseMe ?? allMembers trait gives bunch of strings, and I could not find a way to use them with hasUDA template...

__traits(allMembers) and aliases

2015-08-25 Thread Mike Parker via Digitalmars-d-learn
Is there a way to determine whether a given symbol is an alias? Consider this: ``` module funcs; alias FuncPtr = void function(); @ChooseMe FuncPtr funcPtr; alias anotherName = funcPtr; ``` Handing this module off to __traits(allMembers), then checking for the UDA on each member, I can filter

Re: Template Parameters in Struct Member Functions

2015-08-22 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 August 2015 at 17:08:36 UTC, Mike Parker wrote: void arrayTest(T, int passing) (T arrayT) { ... } I get 'cannot deduce function from argument types' errors. Specifically stating the type of the function doesn't seem to help: test.arrayTest(float [])(farray, 1); test.arrayTe

Re: Template Parameters in Struct Member Functions

2015-08-22 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 August 2015 at 16:49:26 UTC, DarthCthulhu wrote: I'm having difficulty understanding how templates operate as function parameters. Say I have this: struct ArrayTest { void arrayTest(T) (T arrayT) { writeln(arrayT); } } unittest { ArrayTest te

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 05:34:22 UTC, BBasile wrote: static this() { DerelictGL3.load; DerelictGL.load; DerelictSDL2.load; SDL_Init(SDL_INIT_VIDEO); } I should point out that *either* DerelictGL3 *or* DerelictGL should be loaded, but never both. DerelictGL actually ext

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 05:35:30 UTC, Mike Parker wrote: One of the best I've seen is by Anton Gerdelan [1]. The four [1] http://antongerdelan.net/opengl/index.html

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 05:34:22 UTC, BBasile wrote: For me the following code works: --- import derelict.sdl2.sdl; import derelict.opengl3.gl3; import derelict.opengl3.gl; import std.stdio; static this() { DerelictGL3.load; DerelictGL.load; DerelictSDL2.load; SDL_Init(

Re: Derelict, SDL, and OpenGL3: Triangle Tribulations

2015-08-11 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 August 2015 at 03:32:47 UTC, DarthCthulhu wrote: So, any ideas what I'm doing wrong? Too much to list. I suggest you get going with a good tutorial. One of the best I've seen is by Anton Gerdelan [1]. The four basic tutorials he has on his site will be enough to get you up

Re: Dynamic bindings to global variables

2015-08-02 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 2 August 2015 at 15:31:48 UTC, remi thebault wrote: Hello I wrote static bindings to a C library. I want to also offer a version(Dynamic) of the bindings. I follow and use derelict-util to get the address of function pointers. In the library I bind, there is also global variables.

Re: How to run opengl tutorials

2015-08-01 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 1 August 2015 at 22:14:45 UTC, nikolai wrote: Hey, I have found this great source of tutorials for simple game development, yet i am unable to run it properly on Windows 8.1. https://github.com/d-gamedev-team/opengl-tutorials/tree/master/ports/opengl-tutorial.org/tutorials/01_wind

Compiling a DLL with DMC

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
I'm trying to compile a DLL using DMC for use in a sample DMD program, but the link stage keeps failing and I can't figure out why. The C source: ``` #include #ifdef __DMC__ #define WIN32_LEAN_AND_MEAN #include BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) { sw

Re: Type inference of a function parameter

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote: Hello, Why dmd cannot inference the type of 'arr' in my_func() parameter? test.d: import std.stdio; void my_func(auto arr) { writeln(arr); } void main() { auto arr = new int[5]; arr = [1, 2, 3, 4, 5]; my_func(arr); }

Re: extern(C) with function returning user type

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 18:42:45 UTC, Kyoji Klyden wrote: Thanks for the replies, This issue really highlights one of D's weak points I think. I've atleast got a round about solution almost working. :P Really? I see it as one of D's strengths. It's much easier to connect D with C than

Re: C bindings: typedef struct conflicts with method

2015-07-23 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 July 2015 at 06:26:28 UTC, Jacob Carlborg wrote: On 2015-07-23 03:57, Mike Parker wrote: In your case, rd_kafka_metadata is the name of the struct, but in C instances would need to be declared like so: struct rd_kafka_metadata instance; Since the struct is declared directly

Re: C bindings: typedef struct conflicts with method

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 05:53:26 UTC, yawniek wrote: i tried to automagically create bindings for librdkafka (https://github.com/edenhill/librdkafka) with dstep. now the code contains typedefs structs with the same name as methods: ``` typedef struct rd_kafka_metadata { int

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 July 2015 at 01:39:05 UTC, Mike Parker wrote: post at [1] where Rainer shared the relevant bits of a batch Gah, hate it when I forget the links. [1] http://forum.dlang.org/post/m456t5$2jc4$1...@digitalmars.com

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 23:39:46 UTC, Jonathan M Davis wrote: On Wednesday, July 22, 2015 20:27:35 Taylor Hillegeist via Digitalmars-d-learn wrote: I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is

Re: How to get *32mscoff libraries for phobos?

2015-07-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 July 2015 at 20:27:37 UTC, Taylor Hillegeist wrote: I have tried to build this and failed miserably. I have some questions? What make do you use? digital mars, gnu. what tools do you need? is it possible? I also failed to build zlib32coff.lib make[2]: *** No rule to make targe

Re: GLU in DerelictOrg

2015-07-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 July 2015 at 16:34:35 UTC, Spacen Jasset wrote: On Tuesday, 21 July 2015 at 15:17:13 UTC, Alex Parrill wrote: On Tuesday, 21 July 2015 at 14:51:47 UTC, John Colvin wrote: Isn't glu considered legacy these days? I think it's entirely OpenGL 2.x. For the maths stuff see http://cod

Re: Profile Ouput

2015-07-15 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 14 July 2015 at 13:35:40 UTC, Mike Parker wrote: -- 4000 _Dmain _D4main6selectFZk 40002736471 4000 _D3std6random27__T7uniformVAyaa2_5b29TkTkZ7uniformFNfkkZk -- Got it now. The 2736 and 471 are the call tree time

<    6   7   8   9   10   11   12   13   >