Re: DMD requirements (VC runtime version) where?

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 11:23:16 UTC, XavierAP wrote: Visual D has just added support for VS 2017 (kudos), whereas before I had to stick with 2015 at the latest. But DMD has an additional dependency on VS (for x64), and it is not documented, as far as I've been able to find, which versions.

Re: Practical difference between template "alias" arguments/normal generic arguments in this case?

2017-04-12 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 April 2017 at 11:06:13 UTC, Juanjo Alvarez wrote: Hi! With "alias this" accepting runtime variables I'm struggling to FYI, you are not talking about "alias this", but "alias template parameters", two very different concepts. understand the difference between a generic funct

Re: Dub and compilation

2017-04-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 11 April 2017 at 11:13:30 UTC, Russel Winder wrote: This is not what seems to happen with unit-threaded. for the directory ~/.dub/packages/unit-threaded-0.7.11/unit-threaded, the tree is: Just to be clear -- is this what you see after compiling a project that depends on unit-thre

Re: Dub and compilation

2017-04-10 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 11 April 2017 at 05:15:37 UTC, Russel Winder wrote: As I understand it, Dub compiles a downloaded dependency into the local Dub cache. This means you cannot store a debug build and a release build for multiple architectures and different compilers, at the same time, and you only get

Re: Convert this C macro kroundup32 to D mixin?

2017-04-08 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 8 April 2017 at 10:02:01 UTC, Mike Parker wrote: I would expect if you implement it as a function the compiler will inline it. You can always use the pragma(inline, true) [1] with -inline to verify. [1] https://dlang.org/spec/pragma.html#inline This gives me no error, so it d

Re: Convert this C macro kroundup32 to D mixin?

2017-04-08 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 8 April 2017 at 09:53:47 UTC, biocyberman wrote: What is the D mixin version equivalent to this macro: #define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x)) The macro looks cryptic. What the macro does has been explained here: h

Re: Why is this legal?

2017-03-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 March 2017 at 11:17:48 UTC, abad wrote: Yes, does make sense. I was looking this from Java 7 perspective where interfaces can't implement any methods. D did not support them either for much of its history. IIRC, we got them at some point after Java did.

Re: Derelict SDL segfaulting on ubuntu?

2017-03-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 12:20:27 UTC, Mike Parker wrote: have at the bottom of the page the version they were added. But it's easier to look at the source for DerelictSDL2. In order to support the SharedLibVersion, the loader implements functions like this one: And I've just discover

Re: Derelict SDL segfaulting on ubuntu?

2017-03-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 10:32:44 UTC, Robly18 wrote: Well, I have a call to SDL_GetVersion in my code, to check exactly what you're saying. And it spits out "2.0.5", so I don't think that is the problem. I believe I do have it installed: I rm'd the old lib files and used make install

Re: questions about dub

2017-03-21 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 March 2017 at 04:06:50 UTC, Mike Parker wrote: dub fetch --cache=local mir-algorithm Using --cache=local will put the package in the current directory instead of the AppData path. When you aren't using dub to manage your own projects, that makes it easier to deal with (e.g.

Re: questions about dub

2017-03-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 22:51:41 UTC, thorstein wrote: Thanks to all, I got it! I created a new dub package and copied my code there. Compiles. So I guess I get the rest working as well. Still will have to figure out later the procedure to do the same for a VisualD project, if it is pos

Re: Derelict SDL segfaulting on ubuntu?

2017-03-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 19:26:47 UTC, Robly18 wrote: Oh! Right, I forgot to mention that, my bad. The earliest errors were, as you said, mismatched version exceptions. However, to fix them, what I did was, at first, do the 2,0,2 version thing you said. Later, however, I decided to compi

Re: Derelict SDL segfaulting on ubuntu?

2017-03-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 12:39:26 UTC, WebFreak001 wrote: On Tuesday, 21 March 2017 at 12:31:41 UTC, Robly18 wrote: I've been working on a small game of tic tac toe using Derelict SDL, and development has been going along great... Until I tried to develop on my Ubuntu laptop. [...] Dere

Re: Derelict SDL segfaulting on ubuntu?

2017-03-21 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 21 March 2017 at 12:31:41 UTC, Robly18 wrote: Two days of fix attempt laters, here I am. I tried reinstalling and recompiling SDL from source (since the version from apt-get was only 2.0.4 and the one Derelict uses seems to be 2.0.5), and it continues segfaulting at seemingly rando

Re: bug in foreach continue

2017-03-18 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 March 2017 at 00:18:15 UTC, H. S. Teoh wrote: Haha, I don't think I'm up for writing a book... and I don't really keep a blog either. But perhaps a writeup on wiki.dlang.org is in order. This particular topic, I think, is something somebody *should* write about, because it s

Re: Building custom library package with dub

2017-03-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 March 2017 at 12:49:33 UTC, alex1974 wrote: This simple layout works, but then all parts will be compiled every time. Is there a way to just compile the "sublibraries" which have changed? By "compiled every time", if you're talking about when using the library as a dependen

Re: Get most D type from type

2017-03-17 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 March 2017 at 02:23:01 UTC, Hussien wrote: I need the general solution. One that simply returns the type. None of what you said helps... string dtype(T)() { static if(is(T == enum)) return "enum"; else static if(is(T == class)) return "class"; else static if(

Re: code folding

2017-03-14 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 15:44:27 UTC, Inquie wrote: So, with all the bloviating, all I have arrived at is that my original hack is still the only way to get the cold folding I wanted(the original use case I had in mind, even though I'd rather have proper code structuring support in gene

Re: Can i using D & LLVM & SDL2 for Android?

2017-03-13 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 March 2017 at 06:48:01 UTC, Joakim wrote: If you're planning on using Derelict, there is an issue where all Derelict libraries are loaded as shared libraries, whereas the Android port currently doesn't support loading shared libraries. If DLangUI is using SDL2, maybe he has a he

Re: Problems with setting up dub for publication

2017-03-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 March 2017 at 21:14:23 UTC, solidstate1991 wrote: However, after I wrote the dub.json and try to compile it as a test, I get this output: I don't see anything in your config that jumps out at me as a potential cause of your problem (though, see below). Do you have the project

Re: Mixing libraries

2017-03-01 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 2 March 2017 at 02:27:03 UTC, Jordan Wilson wrote: Ah yes, I think you explain the difference between wrapper/binding in one of the Derelict docs. I'm currently working through a ebook on Game Dev with SFML...the examples are all C++. I don't have any trouble translating it to

Re: Mixing libraries

2017-03-01 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 16:12:06 UTC, bauss wrote: There is a better binding. dsfml. You can find it here: http://dsfml.com/ DSFML technically is not a binding (even though it says such on the web site). It's a wrapper that D-ifies the SFML API. The SFML functions are not callable d

Re: Mixing libraries

2017-02-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 28 February 2017 at 20:08:25 UTC, Jordan Wilson wrote: Hello, Been trying to learn the Simple Fast Multimedia Library (SFML) using the Derelict bindings, and noticed some functionality is offered by both SFML and the std library (for example, sfClock and sfMutex). Is there a gen

Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 07:38:04 UTC, Mike Parker wrote: On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost pe

Re: Big Oversight with readln?

2017-02-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 24 February 2017 at 04:22:17 UTC, Jonathan Marler wrote: I discovered the .capacity property of arrays. I don't know why I've never seen this but it looks like this is how readln is recovering this seemingly lost peice of data. This does have an odd consequence though, if you p

Re: How to get the type of a derived class in a method of its base class?

2017-02-19 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 February 2017 at 07:52:13 UTC, Max Samukha wrote: class A { this(T = this)() { static assert(is(T == B)); } } class B { } auto b = new B; Here, T becomes A, which may be reasonable but is completely useless. Is there a way to obtain the type of the class (or cla

Re: JustQuestion: Are 'D' had a browser library?

2017-02-19 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 19 February 2017 at 08:01:56 UTC, dummy wrote: * Derelict-CEF Looks like dead and didn't have a document(or tutorial). It's a binding to the C API of CEF, so you shouldn't expect much documentation or any tutorials with it beyond the binding specific functionality in the README. I

Re: Initialization of dynamic multidimensional array

2017-02-10 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 February 2017 at 09:03:16 UTC, berni wrote: Now I tried this with a named instead of a magic constant e.g. immutable VALUE=-1; arr.each!"a[]=VALUE"; And it doesn't work anymore. I've no clue, why... Can you help me? each is a template. As per the template documentation [1],

Re: Strange behaviour of rdmd vs. dmd concerning main function

2017-02-09 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 9 February 2017 at 16:20:29 UTC, berni wrote: dmd only compiles in the files you actually pass to it. rdmd will try to find the required files automatically. Since you didn't pass the file with the function to dmd, it knows it exists, but leaves it out of the final link (it assum

Re: Pass type directly to a template function?

2017-02-07 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 21:40:04 UTC, Dukc wrote: On Tuesday, 7 February 2017 at 10:21:20 UTC, Mike Parker wrote: function2!float(); //? function3!float(); //? Yes, this is how it's done. Not quite with function3, because it takes one unnamed runtime parameter. It can be call

Re: Pass type directly to a template function?

2017-02-07 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 09:17:04 UTC, Chris Katko wrote: Can I pass a type, instead of a variable of a type, to a template function in order to decide the datatype of T in a function? Yes. That's rather the point. function1(f); //works That is actually shorthand for this: func

Re: module specification for variables

2017-02-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 February 2017 at 09:31:57 UTC, Profile Anaysis wrote: module x; special int X; // special = some keyword that makes this work as I intend. e.g., "no_import int X;" module y; void main() { import x; x.X = 3; // X = 3; fails. } extern(C) int X;

Re: Can you read the next line while iterating over byLine?

2017-02-04 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 4 February 2017 at 08:54:27 UTC, Ivan Kazmenko wrote: On Thursday, 2 February 2017 at 19:34:37 UTC, John Doe wrote: Thanks readln is perfect. Since I am calling readln in different places and I always need to remove the newline character I have line=line[0..$-1] all over my code. I

Re: Trying to understand multidimensional arrays in D

2017-01-26 Thread Mike Parker via Digitalmars-d-learn
Sorry. I mistyped some of my examples. Obviously dropped some news: auto a = new int[](4); auto b = new int[][](4); And the static arrays should be: int[4] c; int[][4] d; And I would also like managed to overlook there is no static array in sight here: auto y = new int[1][2][][](3,4); The

Re: Trying to understand multidimensional arrays in D

2017-01-26 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 26 January 2017 at 05:50:03 UTC, Profile Anaysis wrote: It is inconsistent with dynamic arrays and mixing them creates a mess in the order of indices. I best someone was asleep at the wheel when programming the code for static arrays. (probably someone different than who progra

Re: Confirming and uninstantiated struct

2017-01-23 Thread Mike Parker via Digitalmars-d-learn
On Monday, 23 January 2017 at 13:57:23 UTC, aberba wrote: if (stu is Student.init) //will confirm when i get to my pc That works, as does this: if(stu == Student.init)

Re: Can't understand if deallocation happens?

2017-01-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 January 2017 at 15:59:47 UTC, Suliman wrote: On Sunday, 22 January 2017 at 15:51:01 UTC, Suliman wrote: string str = "abc"; writeln(str.ptr); str = "def"; writeln("last data: ", *(str.ptr)); writeln("old data: ", *(str.ptr-1)); // print nothi

Re: Making .exe

2017-01-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 January 2017 at 21:47:53 UTC, Dlearner wrote: Yo! Okay I did this and I run the .exe and it works, but if I try to copy/paste it on my desktop and run it, it (obviously) doesn't work. Is there a way to somehow compile the source, .dll's and image file that I'm using together

Re: DMD Refuses to Compile Multiple Source Files

2017-01-18 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 23:12:15 UTC, Mike Parker wrote: (source files), then use the import statement to make the declarations in other modules. Sorry, this should read "make the implementations available to other modules".

Re: DMD Refuses to Compile Multiple Source Files

2017-01-18 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 19:28:20 UTC, Samwise wrote: Alright, so I misunderstood what ketmar was saying. His solution did work. I'm just not sure I understand what you are trying to say here: But really, the proper thing to do is to drop the prototype and import the module with the

Re: DMD Refuses to Compile Multiple Source Files

2017-01-17 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 18 January 2017 at 04:06:23 UTC, Samwise wrote: On Wednesday, 18 January 2017 at 03:51:50 UTC, ketmar wrote: On Wednesday, 18 January 2017 at 03:37:46 UTC, Samwise wrote: extern int getReturnCode() { return 4; } still does not compile using the command from above. I may

Re: Namespaces like C++

2017-01-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 January 2017 at 18:02:09 UTC, Andrey wrote: Hello, can I using namespaces like in C++, for example: ui::Widget or ui::Manager? I created ui/widget.d and ui/manager.d for implementation classes Widget and Manager, bun I can't import their correctly for using ui.Manager uiManager;

Re: Linking C Headers to D

2017-01-11 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 January 2017 at 04:54:18 UTC, DRex wrote: Hi, I am trying to link C and D (using GCC and GDC) and I am wondering (I could find no answers on google) if it is possible to compile C headers into object files and link them to D? I have a large code base of C headers and am not a

Re: Loading assimp

2017-01-09 Thread Mike Parker via Digitalmars-d-learn
On Monday, 9 January 2017 at 18:13:03 UTC, Dlearner wrote: I'm trying to use assimp to load models in a program. I see the Derelict binding is for version 3.3, but the assimp site has no binaries for this, just source. So I try to use version 3.1.1 and I get this error: derelict.util.except

Re: Conditional Compilation Multiple Versions

2017-01-06 Thread Mike Parker via Digitalmars-d-learn
Glad hear it's working for you! On Friday, 6 January 2017 at 10:25:26 UTC, Claude wrote: So I had a stream of: version (Win32) enum bool WindowsSupported = true; else enum bool WindowsSupported = false; version (Win64) enum bool WindowsSupported = true; //Ooops else enum bool Windows

Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.

2016-12-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 16 December 2016 at 22:37:13 UTC, hardreset wrote: To be honest I was having some odd linking problems anyway. I initially wrapped the FT init function in plain D function and that kept causing "_FT_ not found" link errors. As soon as I took all the actual D functions out and le

Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.

2016-12-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 15 December 2016 at 20:34:47 UTC, hardreset wrote: On Thursday, 15 December 2016 at 18:30:14 UTC, hardreset wrote: I have pragma(lib,**fullpath**) in my freetype.d file, is that the correct way? Never mind, figured it out, I needer to add "libs": ["libs/freetype27ST"] to dub.j

Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.

2016-12-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 14 December 2016 at 23:08:30 UTC, hardreset wrote: I built Freetype with MSVC13 and tried to link it but DMD didnt like the format, so what should compiler (free) should I use for building DMD compatible static libs? The MS linker produces COFF format. By default, DMD uses the O

Re: The order of libraries makes error in dub

2016-12-05 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 December 2016 at 14:29:42 UTC, unDEFER wrote: On Monday, 5 December 2016 at 11:51:52 UTC, unDEFER wrote: "libs-posix": ["db"], "sourceFiles-windows-dmd": ["libdb53d.lib", "WS_32.LIB"], "dflags-windows": ["-m32mscoff"], "subPackages": [ I understand that I do

Re: [Derelict-GL3] GLSL: Syntax error unexpected tokens following #version

2016-12-04 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 4 December 2016 at 08:30:40 UTC, Mike Parker wrote: your shader, print out the result of glGetString(GL_VERSION) to Alternatively, since you're using Derelict, you can check the return value of DerelictGL3.reload() or, any time after calling it, DerelictGL3.loadedVersion.

Re: [Derelict-GL3] GLSL: Syntax error unexpected tokens following #version

2016-12-04 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 4 December 2016 at 06:41:07 UTC, Payotz wrote: So I've been trying to teach myself how to OpenGL, and there are errors whenever I try to compile my shaders. Errors are : http://i.imgur.com/5hRaQL8.png Why the screenshot? Simpler to respond to copy/pasted text. The second line is a

Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 1 December 2016 at 23:51:19 UTC, Payotz wrote: The register method will take in delegates as an argument, but those delegates have varied arguments themselves, so I can't really put anything there. I know that it's got something to do with templates so I tried my hand in it and ca

Re: Using the result of a comma expression is deprecated

2016-11-27 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 27 November 2016 at 16:32:26 UTC, Suliman wrote: Looks like you forgot a call to format before the opening parenthesis. should be: string sqlinsert = format(`INSERT INTO usersshapes (userlogin, uploading_date, geometry_type, data) VALUES ('%s', '%s', '%s', '%s') `, login, uploading

Re: Reading image files

2016-11-25 Thread Mike Parker via Digitalmars-d-learn
On Friday, 25 November 2016 at 20:10:56 UTC, solidstate1991 wrote: glitchy image after rendering the result) and I have no idea how DerelictFI works at all, DerelictFI is just a binding to FreeImage, so the more relevant point to consider is how FreeImage works :-) Everything you need to kn

Re: Linking g++ compiled object files

2016-11-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 November 2016 at 20:09:29 UTC, Rubikoid wrote: So, is there any way to use gcc/g++ under windows? DMD can work with COFF objects when given -m32mscoff when compiling 32-bit and -m64 for 64-bit. In both cases, yoi will need the Microsoft linker and SDK intalled. However, when

Re: Compiling and linking libraries

2016-11-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 November 2016 at 01:01:16 UTC, Darren wrote: Thank you for this! Great information. So dub dynamically "add" code from the dll into the source code at runtime? No. DUB doesn't have anything to do with runtime and doesn't know anything about the DLLs you use. The Derelict pack

Re: Compiling and linking libraries

2016-11-16 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 16 November 2016 at 14:59:40 UTC, Edwin van Leeuwen wrote: If you are happy to use dub I would just add the GL library as a dependency to my dub.json file. Then if you call dub it will download and compile the necessary file. Example dub.json file: ``` { "name": "myWin

Re: static array internal & dangling reference

2016-11-12 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 12 November 2016 at 13:11:02 UTC, Mike Parker wrote: void func2(int[] foo) { foo ~= 10; } Sorry, this should be (ref int[] foo)

Re: static array internal & dangling reference

2016-11-12 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 12 November 2016 at 12:16:02 UTC, Andrew wrote: Bear in mind that static arrays are implicitly sliced when passed to or returned from a function anywhere a dynamic array is expected. If you modify f() to look like this: int[] f() { int[10] sa; foreach(int i, ref sa_i;sa){

Re: static array internal & dangling reference

2016-11-12 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 12 November 2016 at 10:33:05 UTC, Picaud Vincent wrote: Hi all, Still learning... This time what surprised me is how static arrays work. I assume (is it true?) that for efficiency reason static size arrays like int[10] are on the stack and do not involve dynamic memory allocation:

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-07 Thread Mike Parker via Digitalmars-d-learn
On Monday, 7 November 2016 at 06:22:16 UTC, Mike Parker wrote: What I would do rather than adding -m32mscoff in additional options Oh, and I forgot. Don't set the lib path in additional options either. In 'Configuration Properties -> Linker', enter the path in the 'Library Search Path' fie

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-07 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 November 2016 at 17:57:23 UTC, Sarcross wrote: Building Debug\Resume_Parser.exe... OPTLINK (R) for Win32 Release 8.00.17 "$(VisualDInstallDir)pipedmd.exe" dmd -g -debug -X -Xf"$(IntDir)\$(TargetName).json" -deps="$(OutDir)\$(ProjectName).dep" -of"$(OutDir)\$(ProjectName).exe

Re: Error 42 When Trying to Interop with a C# Libary

2016-11-05 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 5 November 2016 at 22:06:21 UTC, Sarcross wrote: LINK : fatal error LNK1104: cannot open file '+C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2.lib' --- errorlevel 1104 dmd failed with exit code 1104. "lflags" : ["+C:\\Users\\antzy_000\\Documents\\Program

Re: strange -fPIC compilation error

2016-11-01 Thread Mike Parker via Digitalmars-d-learn
On Monday, 31 October 2016 at 19:20:21 UTC, Charles Hixson wrote: but dmd -defaultlib=libphobos2.so -fPIC test.d works. It shouldn't be required (as in the default /etc/dmd.conf should handle it correctly, but I can deal with it now. The need to manually add this to dmd.conf is a very recen

Re: newbie problem with nothrow

2016-11-01 Thread Mike Parker via Digitalmars-d-learn
On Monday, 31 October 2016 at 22:20:59 UTC, Kapps wrote: Wrap a body of the function to try {} catch {} and it'll work. Assuming you're sure it'll never throw. To enforce this, use try { } catch { throw new Error("blah"); }. You can still throw errors, just not exceptions (as errors are not

Re: newbie problem with nothrow

2016-10-31 Thread Mike Parker via Digitalmars-d-learn
On Monday, 31 October 2016 at 16:55:51 UTC, WhatMeWorry wrote: Is there a way to turn off nothrow or work around it? Because to me it looks like nothrow prevents me from doing anything useful. extern(C) void onKeyEvent(GLFWwindow* window, int key, int scancode, int action, int modifier) not

Re: A question of function design?

2016-10-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 October 2016 at 13:19:19 UTC, WhatMeWorry wrote: Anyone have a good example of what I should be doing? I generally use GLFW event callbacks to populate an event queue with custom event types, then process the queue and handle events elsewhere. That way, the callbacks need no n

Re: New to D

2016-10-22 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote: uint[string] dictionary; should be uint[size_t] dictionary; because size_t is 32bit on x86 system and 64bit on x86_64 and you are trying to put array length to dictionary which is size_t I believe you meant: size_t[string];

Re: Render SVG To Display And Update Periodically

2016-10-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 October 2016 at 03:59:16 UTC, Jason C. Wells wrote: First, thank you for taking the time to help me with something that should be trivial. I've done the above listing of file on the command line but I'm still stuck. I'm starting to think that I might actually be tripping over

Re: New to D

2016-10-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 October 2016 at 05:41:34 UTC, Mark wrote: Thanks for the fast reply. That did work. But now the error is on the line: dictionary[word] = newId; I changed the value to 10, still errors. ?? everything else is as before. thanks. For simple single file experiments lik

Re: Render SVG To Display And Update Periodically

2016-10-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 October 2016 at 23:16:55 UTC, Jason C. Wells wrote: I've tinkered with what you proposed. In the process I've worked through a variety of errors and ended up doing things I don't think are a good solution like duplication directories so that a library can be found. Let me see if

Re: Render SVG To Display And Update Periodically

2016-10-20 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 20 October 2016 at 04:52:11 UTC, Jason C. Wells wrote: This is probably a general programming question. I'll follow up here since this thread is the inspiration for my current question. When attempting to compile simpledisplay.d, I get the following: C:\...\dlang\arsd-master>dmd

Re: Visual Studio Linker Problem

2016-10-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 05:23:15 UTC, Jason C. Wells wrote: $ ldc2 hello.d Using Visual C++: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC I see mention of a "vcvarsall.bat" file that might set my paths correctly, but this file is not found on my system. Are you sure? The

Re: Visual Studio Linker Problem

2016-10-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 18 October 2016 at 05:23:15 UTC, Jason C. Wells wrote: The file "libucrt.lib" is found in several VS folders. I am sure that this is some path issue, but I'm not savvy on VisualStudio. I read some scary messages about this error in other parts of the forum from about a year ago. H

Re: Continued looking at properties in D - interfaces and constraints

2016-10-12 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 12 October 2016 at 06:20:05 UTC, mikey wrote: On Sunday, 9 October 2016 at 14:06:42 UTC, Antonio Corbi wrote: 1. Inheritance with contracts is evaluated in a special way, 'in contracts' in the base and derived method (property) are or-ed, so if one of them passses, the contract is

Re: dub command line in config?

2016-10-09 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 9 October 2016 at 05:34:36 UTC, Jinx wrote: huh? Yes it is necessary. How hard could it be. Editing a script is the same as editing the json file and creates junk files. Why make things harder than they have to be? Seems like it would be rather trivial to implement. Harder is re

Re: dub command line in config?

2016-10-08 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 8 October 2016 at 23:05:51 UTC, Jinx wrote: how to add command line options to the dub.json so they do not have to be typed on the command line every time? AFAIK, there's not support for this. Is it really necessary, though? It's a one line shell script.

Re: Beginner DUB user question...

2016-10-08 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 9 October 2016 at 01:24:57 UTC, WhatMeWorry wrote: I've got a little hello_window DUB project which uses these dependencies: dependency "derelict-util" version="~>2.0.6" dependency "derelict-glfw3" version="~>3.1.0" dependency "derelict-gl3" version="~>1.0.19" dependency

Re: Getting GtkD working with OpenGL

2016-10-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 10:49:40 UTC, Chalix wrote: glMatrixMode(GL_MODELVIEW); /*Here the program crashes with There are two things wrong with your use of Derelict. First, though you are correctly importing derelict.opengl3.gl to get the deprecated functions (which the gl3 mo

Re: Struct immutable data and dict

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 03:05:18 UTC, Patric Dexheimer wrote: But why i´m overwriting the struct if its the first time i´m putting it there? (like on the array). There's a difference between initialization and assignment. ``` // Given this structure struct MyStruct { int x; } // Both

Re: Stupid User error with DUB/Derelict runtime issue?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 6 October 2016 at 00:13:20 UTC, WhatMeWorry wrote: Dub/Derelict is returning the following error at the D line: DerelictFT.load(); // Load the FreeType library derelict.util.exception.SharedLibLoadException@C:\Users\kheaser\AppData\Roaming\dub\packages\derelict-util-2.0.6\s

Re: How dub select versions?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 08:23:25 UTC, Mike Parker wrote: The ~> constrains the dependency to the minor version number, meaning DUB will not try to use a version of the dependency that has a higher minor version. Oh, that came out wrong. TO be clear for anyone who doesn't read the l

Re: How dub select versions?

2016-10-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 October 2016 at 08:01:33 UTC, Daniel Kozak wrote: I really does not understand how does DUB works. I have small app which use vibe-d:core as dependency, and I use libasync as subConfiguration. When I try to build my app it always try to download libasync-0.7.9 instead of libasyn

Re: Why using wrappers for D?

2016-10-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 October 2016 at 17:19:47 UTC, Chalix wrote: If I "import foo;" in my project, it will be compiled alongside. So there is no need for an extra library. Same should be for wrapfoo.d. If I "import wrapfoo;", I should just need the C-library "foo", and no D-library "food" right? Y

Re: Why using wrappers for D?

2016-10-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 October 2016 at 12:08:54 UTC, Chalix wrote: Furthermore, if there is an not very popular C library, where no wrapper function exists, would it possible to include it into a D project? Probably I have to transform all the .h to .d files, so i can "import" them instead of "include"

Re: Reinstalled Mac

2016-09-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 September 2016 at 09:15:15 UTC, Guillaume Piolat wrote: On Wednesday, 28 September 2016 at 08:18:40 UTC, Joel wrote: I'm thinking using home brew. Use the DMD installer instead on dlang.org Any particular reason? I've been using homebrew for it. I like the simple command li

Re: May be a simple dub answer if my question even makes sense?

2016-09-24 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 24 September 2016 at 16:51:47 UTC, WhatMeWorry wrote: My app.d has: module app; import common.derelict_libraries; and derelict_libraries.d has: module derelict_libraries; import derelict.glfw3.glfw3; import derelict.opengl3.gl3; It's fine to import other imports, Right? As l

Re: May be a simple dub answer if my question even makes sense?

2016-09-23 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 24 September 2016 at 02:33:22 UTC, WhatMeWorry wrote: I see that dub has all the .d import files already placed in C:\Users\Me\AppData\Roaming\dub\packages\derelict-gl3-1.0.19\derelict-gl3\source\derelict\opengl3 and C:\Users\Me\AppData\Roaming\dub\packages\derelict-glfw3-3.1.0\d

Re: Using OpenGL

2016-09-15 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 15 September 2016 at 19:03:22 UTC, Darren wrote: This is the code I'm using: https://dfcode.wordpress.com/2016/09/15/texcodewip/ (The code for the shaders is at the bottom) For comparison, this is the code I'm trying to make work: http://www.learnopengl.com/code_viewer.php?code=

Re: Using OpenGL

2016-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 14 September 2016 at 16:49:51 UTC, Darren wrote: While googling, the idea seemed to be to create and SDL_Surface* and pass that (or surface.pixels) as the last argument for glTexImage2D. Didn't work for me, however. Does anyone have any tips? I'm driving blind here without

Re: Confusion over what types have value vs reference semantics

2016-09-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 September 2016 at 16:10:04 UTC, Mike Parker wrote: And here, no memory is allocated. barSlice.ptr is the same as bar.ptr and barSlice.length is the same as bar.length. However, if you append a new element: barSlice ~= 10; The GC will allocate memory for a new array and barSlice

Re: Confusion over what types have value vs reference semantics

2016-09-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 September 2016 at 15:15:09 UTC, Neurone wrote: Hi, Are there universal rules that I can apply to determine what types have reference or value semantics? I know that for the basic primitive C types (int, bool, etc) has value semantics. Primitive types (int, bool, etc) and struct

Re: What is this behavior and how do I disable or get around it?

2016-09-04 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 September 2016 at 00:26:01 UTC, pineapple wrote: This program does not compile. Error: cannot implicitly convert expression (cast(int)x - cast(int)x) of type int to ubyte void main(){ ubyte x; x = x - x; } I don't even know what to say. Who thought this b

Re: Using OpenGL

2016-09-03 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 3 September 2016 at 16:01:34 UTC, Mike Parker wrote: The following compiles, runs, and shows the triangle. It's the code you posted above with the corrected call to glBufferData along with more D style (as I would write it anyway) and less C. One thing I overlooked. In lines wher

Re: Using OpenGL

2016-09-03 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 3 September 2016 at 12:40:58 UTC, Darren wrote: I went through another tutorial. Changed the source code and left out the shaders. I get another coloured background but still no triangle. I have a feeling that glBufferData(GL_ARRAY_BUFFER, cast(int)g_vertex_buffer_data.s

Re: Using OpenGL

2016-09-03 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 3 September 2016 at 11:02:11 UTC, Lodovico Giaretta wrote: glGetShaderInfoLog(vertexShader, 512, null, &infoLog[0]); I prefer: glGetShaderInfoLog(vertexShader, 512, null, infoLog.ptr);

Re: Using OpenGL

2016-09-03 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 3 September 2016 at 11:13:30 UTC, Lodovico Giaretta wrote: Ah! Well, providing error messages is always useful. Now I see your issue: your callback has D linkage, but OpenGL expects a function with C linkage. So you have to put `extern(C)` on your callback declaration. Well, it

Re: Using OpenGL

2016-09-02 Thread Mike Parker via Digitalmars-d-learn
On Friday, 2 September 2016 at 20:38:15 UTC, Darren wrote: I'm trying to teach myself OpenGL but I'm not sure how to set it up exactly. I used "dub init" to create a project, I downloaded glew32.dll and glfw.dll and put them in this folder. I added "derelict-gl3": "~>1.0.19" and "derelict-glfw

Re: Classes and Structs, Memory management questions

2016-09-02 Thread Mike Parker via Digitalmars-d-learn
On Friday, 2 September 2016 at 08:43:45 UTC, dom wrote: from what i got Classes are always reference types and structs are value types in D. i am wondering why that is. for me the main difference between classes and structs is not how they are allocated, but that one has inhertiance, and the ot

Re: Prevent copy of range in foreach

2016-08-31 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 31 August 2016 at 23:38:21 UTC, Yuxuan Shui wrote: OK, this would work for cases like containers. But what if I represent buffered network input as a range (like File.byLine), and I don't want to copy the buffer all the time? Any suggestion on how to do that correctly? Then t

<    3   4   5   6   7   8   9   10   11   12   >