Re: Error: 'this' is only defined in non-static member functions

2017-11-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 November 2017 at 22:45:53 UTC, A Guy With a Question wrote: Out of curiosity, what does static mean in that context? When I think of a static class I think of them in the context of Java or C# where they can't be instantiated and where they are more like namespaces that you

Re: DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 November 2017 at 14:15:21 UTC, Mike Parker wrote: The proper place to report this sort of issue is at the DerelictGL3 issues page [1]. You'll also want to include some minimal, reproducible sample code. [1] https://github.com/DerelictOrg/DerelictGL3/issues

Re: DerelictGL3.reload(); crashes in release mode, but not in debug

2017-11-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 18 November 2017 at 12:36:36 UTC, Dennis wrote: I'm trying to set up a game window with Derelict glfw and opengl. When I perform a default (debug) build, it correctly shows a window, but when I do this: dub run "--build=release" Then I get this: object.Error@(0): Access

Re: User defined type and foreach

2017-11-16 Thread Mike Parker via Digitalmars-d-learn
On Friday, 17 November 2017 at 03:15:12 UTC, Tony wrote: Thanks T! Good information, especially "iterating over a range is supposed to consume it". I have been reading dlang.org->Documentation->Language Reference, but should have also read dlang.org->Dlang-Tour->Ranges. Although that page

Re: How do I use Socket.select?

2017-11-12 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 12 November 2017 at 21:45:56 UTC, Anonymouse wrote: But a "status change" for a reading Socket is "stuff can now connect", for a writing one "connection established", and not sure about the error ones. It doesn't seem to be "there's data waiting to be read" which I'd hoped for,

Re: convert string to ubyte[]

2017-11-11 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 11 November 2017 at 15:38:18 UTC, aki wrote: Hello, This will be trivial question but I cannot figure out what's wrong. I want to convert string to an array of ubyte. import std.conv; void main() { auto s = "hello"; ubyte[] b = to!(ubyte[])(s); } It compiles but

Re: Cyclic dependency error

2017-11-07 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 7 November 2017 at 14:05:41 UTC, Steven Schveighoffer wrote: On 11/7/17 7:49 AM, Tony wrote: My program compiled, but when I ran it I got this error message: object.Error@src/rt/minfo.d(371): Cyclic dependency between module variable and main variable* -> misc -> main* ->

Re: dub optional dependency

2017-10-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 October 2017 at 01:55:22 UTC, evilrat wrote: This is dub design choice, optional requires manual fetching(dub fetch 'package'). I don't see other options, but you can try hack this using 'preBuildCommands' by adding dub fetch. Of course this defeats the purpose. No, they

Re: dub optional dependency

2017-10-28 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 28 October 2017 at 19:23:42 UTC, ikod wrote: So default version is "std", I can build it w/o vibe-d, but dub anyway fetch vibe-d. I'd like dub fetch vibe-d only when I build with --config vibed. As far as I know, that isn't possible. A package is either optional, or it isn't.

Re: How do I convert a LPVOID (void*) to string?

2017-10-19 Thread Mike Parker via Digitalmars-d-learn
On Monday, 16 October 2017 at 21:48:35 UTC, Nieto wrote: How do I convert/create a D string from LPVOID (void*)? string GetLastErrorMessage() { LPVOID lpMsgBuf; DWORD errorMessageID = GetLastError(); FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER |

Re: Infuriating DUB/DMD build bug.

2017-10-06 Thread Mike Parker via Digitalmars-d-learn
On Friday, 6 October 2017 at 09:12:09 UTC, Mike Parker wrote: On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote: AppData/Roaming/dub/packages, create a new directory off C: (say, C:\dub, manually fetch the packages you need into that directory and use `dub add-local` on them

Re: Infuriating DUB/DMD build bug.

2017-10-06 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 October 2017 at 21:48:20 UTC, WhatMeWorry wrote: With writing files, that's usually a permissions thing? But all the other 8 packages build fine? Note: I had a similar problem with derelict-assimp3 package, so I went to an entirely different system and cloned my project.

Re: Imports

2017-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 October 2017 at 12:25:27 UTC, Mike Parker wrote: And actually, now that I think about it, this is probably one of those situations where the defualt fails. So yes, you'll need a module name. Right. I had to go back and look at what I wrote in Learning D, which is the last

Re: Imports

2017-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 October 2017 at 12:18:57 UTC, Mike Parker wrote: Regardless, every module should have a module name at the top. There are situations where the inferred package & module names can't work. Ugh. Sorry, I mean for sourcePaths you have to pass `src` and not `dir`. And actually,

Re: Imports

2017-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 October 2017 at 12:17:23 UTC, Mike Parker wrote: On Thursday, 5 October 2017 at 11:44:00 UTC, Jiyan wrote: [...] But as i see it with sourcePaths the directories are not influencing the module names(in the directories except "source"), so "dir.sub" will just have the name

Re: Imports

2017-10-05 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 5 October 2017 at 11:44:00 UTC, Jiyan wrote: [...] But as i see it with sourcePaths the directories are not influencing the module names(in the directories except "source"), so "dir.sub" will just have the name "sub" is there a way around that, except naming every module like:

Re: Imports

2017-10-04 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 4 October 2017 at 16:31:35 UTC, Jiyan wrote: Hey, as i see it the -Ipath command for dmd just imports the files within a directory but it doesnt work for sub directories, so i can write something like: import subdirectoryFromPath.file; Also with dub this doesnt seem possible

Re: Dub use local fork

2017-09-22 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 23 September 2017 at 03:13:15 UTC, Nicholas Wilson wrote: my dub.selections.json is currently: { "fileVersion": 1, "versions": { "derelict-cl": "2.0.0", "derelict-cuda": "2.0.1", "derelict-util": "2.1.0",

Re: Problems with function as parameter

2017-09-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 September 2017 at 02:32:56 UTC, Josh wrote: Why should the binding force nothrow? I don't understand why you HAVE to not throw exceptions. Is it because of the C -> D aspect? Yes, it's because D exceptions are not guaranteed to propagate through the C callstack. It works on

Re: Problems with function as parameter

2017-09-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 September 2017 at 02:32:56 UTC, Josh wrote: Why should the binding force nothrow? I don't understand why you HAVE to not throw exceptions. Is it because of the C -> D aspect? Yes, it's because D exceptions are not guaranteed to propagate through the C callstack. It works on

Re: Problems with function as parameter

2017-09-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 September 2017 at 02:22:46 UTC, Josh wrote: src\mixer.d(80,22): Error: function pointer Mix_ChannelFinished (extern (C) void function(int channel)) is not callable using argument types (extern (C) void delegate(int channel)) Code: void unmuteAfterPlaySound() {

Re: Problems with function as parameter

2017-09-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 September 2017 at 02:18:34 UTC, Mike Parker wrote: and use & to reference the function instead of calling it: Mix_ChannelFinished(); To expand on this, D allows functions to be called without parentheses. `channelDone` is actually a function call, whereas in C, it's treated

Re: Problems with function as parameter

2017-09-21 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 21 September 2017 at 22:05:22 UTC, Matt Jones wrote: On Thursday, 21 September 2017 at 20:21:58 UTC, Josh wrote: I'm trying to write a callback function for SDL_mixer through Derelict, but this is the first time I've tried to use a function as a parameter, and so I think I'm just

Re: Looking for instructions on how to make a Derelict library

2017-09-18 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote: On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote: I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too. Thanks. Might be interesting to write up

Re: extern(C) enum

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Monday, 18 September 2017 at 02:04:49 UTC, bitwise wrote: On Monday, 18 September 2017 at 00:12:49 UTC, Mike Parker wrote: On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote: [...] I've been maintaining bindings to multiple C libraries (including Freetype 2 bindings) for 13

Re: Looking for instructions on how to make a Derelict library

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 September 2017 at 21:15:08 UTC, Matt Jones wrote: Hey everyone, I wanted to make a version of SQlite3 that uses Derelict to load the sqlite3 DLL when I'm ready. I can't find any instructions for how to make a basic Derelict style library. I looked around at

Re: extern(C) enum

2017-09-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 September 2017 at 19:16:06 UTC, bitwise wrote: On Sunday, 17 September 2017 at 18:44:47 UTC, nkm1 wrote: On Sunday, 17 September 2017 at 17:06:10 UTC, bitwise wrote: [...] Just put the burden on the users then. It's implementation defined, so they are in position to figure it

Re: failed loading freetype 2.6 via derelict-ft

2017-09-15 Thread Mike Parker via Digitalmars-d-learn
On Friday, 15 September 2017 at 16:04:52 UTC, Spacen wrote: Thanks for the reply that is exactly it. I downloaded several dlls from the internet, and then decided to build it myself. I see there is a bzip configuration option but I'll need to read the documentation and presumably bzip gets

Re: failed loading freetype 2.6 via derelict-ft

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 22:18:07 UTC, Mike Parker wrote: Missing symbols usually mean a version mismatch. The latest DerelictFT requires FreeType 2.6 or later. It could also mean your shared library was compiled without bzip2 support. I'm on my phone right now else I'd check it

Re: DerelictGL3 slow compilation speed with contexts

2017-09-14 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 16:30:34 UTC, Igor wrote: I tested it again with my entire project and it seems it is not inline thing but -O (optimized build). You can checkout the project here: https://github.com/igor84/dngin if you try to build it with "dub build -ax86_64 -b release"

Re: failed loading freetype 2.6 via derelict-ft

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 20:16:23 UTC, Igor wrote: Make sure dll is also 32bit if you are building 32bit app and your Visual Studio should have dumpbin utility which you can use to make sure the required symbols are properly exported: dumpbin /EXPORTS your.dll In that case, he'd

Re: failed loading freetype 2.6 via derelict-ft

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 19:01:52 UTC, Spacen wrote: Hello, I am trying to resurect an old project, but can't get the freetype library loaded. I can't figgure out what to do it's been a while. I have just built the freetype 2.6 library with visual studio 2015. Any tips would be

Re: DerelictGL3 slow compilation speed with contexts

2017-09-13 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 13 September 2017 at 10:28:26 UTC, Igor wrote: Well since minimal example is a window app that opens a window, sets everything up and calls opengl stuff I will just push it to my github project this evening and you will can try with that. I will let you know when its done. In

Re: DerelictGL3 slow compilation speed with contexts

2017-09-12 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 21:55:23 UTC, Igor wrote: Hi All, I switched from using free functions in DerelictGL3 to DerelictGL3_Contexts and compilation speed in optimized build using DMD went from 2 seconds to 7 minutes and using LDC from 2 seconds to 10 seconds. Is this a known

Re: Ranges seem awkward to work with

2017-09-11 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote: Is this is a common beginner issue? I remember using an earlier version of D some long time ago and I don't remember seeing this concept. Now, a lot of library functions seem to expect ranges as inputs and return ranges as

Re: 24-bit int

2017-09-02 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 2 September 2017 at 07:20:07 UTC, kinke wrote: struct int24 { ubyte[3] _payload; } static assert(int24.sizeof == 3); static assert(int24.alignof == 1); Making absolute sense. ubytes don't need any specific alignment to be read efficiently. Yes, that does make sense. It

Re: 24-bit int

2017-09-01 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 2 September 2017 at 01:19:52 UTC, EntangledQuanta wrote: The whole point is so that there is no wasted space, so if it requires that then it's not a waste of space but a bug. Audio that is in24 is 3 bytes per sample, not 4. Every 3 bytes are a sample, not every 3 out of 4.

Re: DIPs - question about mores, etiquette and DIP1009 in particular

2017-08-30 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 30 August 2017 at 22:50:22 UTC, Cecil Ward wrote: On Wednesday, 30 August 2017 at 22:09:21 UTC, Mike Parker wrote: On Wednesday, 30 August 2017 at 17:16:11 UTC, Cecil Ward wrote: DIPs are not voted on. Thanks for letting me know, answers my question. Our leaders would perhaps

Re: C callbacks getting a value of 0! Bug in D?

2017-08-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 29 August 2017 at 01:34:40 UTC, Johnson Jones wrote: import core.stdc.config; pragma(msg, c_long.sizeof); prints 4UL both on x64 and x86 and and C: void foo() { int dummy; switch (dummy) { case sizeof(long) : case sizeof(long) :

Re: General performance tip about possibly using the GC or not

2017-08-28 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 29 August 2017 at 00:52:11 UTC, Cecil Ward wrote: I am vacillating - considering breaking a lifetime's C habits and letting the D garbage collector make life wonderful by just cleaning up after me and ruining my future C disciple by not deleting stuff myself. It's not a panacea,

Re: No CTFE of function

2017-08-27 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 27 August 2017 at 17:47:54 UTC, Cecil Ward wrote: I wonder if there is anything written up anywhere about what kinds of things are blockers to either CTFE or to successful constant-folding optimisation in particular compilers or in general? Would be useful to know what to stay

Re: D Code to html

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 20:03:16 UTC, Andre Pany wrote: Hi, how does the D syntax highlighting in e.g. https://dlang.org/blog/2017/08/23/d-as-a-better-c/ works? From reading the html source code I understand there is some functionality prettyprint but not how it is included and what

Re: DerelictGL3 reload crashes in 32 builds

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: In the meantime can you tell me these two things: 1. How come DerelictGLES only has: static if( Derelict_OS_Windows ) ... else static if( Derelict_OS_Posix && !Derelict_OS_Mac )... when GLES is primarily intended for mobile platforms as

Re: DerelictGL3 reload crashes in 32 builds

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 August 2017 at 16:54:24 UTC, Igor wrote: On Tuesday, 22 August 2017 at 12:03:18 UTC, Igor wrote: On Monday, 21 August 2017 at 12:38:28 UTC, Mike Parker wrote: Have you tried to compile outside of VisualD? Hmmm... I though I tried running with just typing dub which should use

Re: Long File path Exception:The system cannot find the path specified

2017-08-23 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 23 August 2017 at 05:06:50 UTC, Vino.B wrote: Hi All, When i run the below code in windows i am getting "The system cannot find the path specified" even though the path exist , the length of the path is 516 as below, request your help. Path :

Re: DerelictGL3 reload crashes in 32 builds

2017-08-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 21 August 2017 at 02:40:59 UTC, Mike Parker wrote: On Sunday, 20 August 2017 at 19:29:55 UTC, Igor wrote: In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes. Using LDC debug build I managed to find that it crashes after

Re: DerelictGL3 reload crashes in 32 builds

2017-08-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 August 2017 at 19:29:55 UTC, Igor wrote: In 64 bit builds it works with both LDC and DMD but in 32 bit LDC version crashes and DMD release version crashes. Using LDC debug build I managed to find that it crashes after executing ret instruction from bindGLFunc in glloader. If

Re: std.range.put vs R.put: Best practices?

2017-08-20 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 20 August 2017 at 18:08:27 UTC, Jon Degenhardt wrote: Documentation for std.range.put (https://dlang.org/phobos/std_range_primitives.html#.put) has the intriguing line: put should not be used "UFCS-style", e.g. r.put(e). Doing this may call R.put directly, by-passing any

Re: DlangUI Error

2017-08-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 August 2017 at 23:38:42 UTC, Jiyan wrote: So the strange thing is i had an older compiler (v2.074.1), so i started running the 2.075 version - with which it worked! The thing is i can start the 2.075 version only over the activate.sh script in a shell. Can you tell me how i

Re: Constructor is not callable using argument types

2017-08-08 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 8 August 2017 at 06:03:06 UTC, Nrgyzer wrote: Hi guys, I've the following code: abstract class a {} class b : a { this(a* myAttr = null) {} } class c : a { this(a* myAttr = null) {} } void main() { auto myb = new b(); auto myc = new c(); } DMD says "Constructor c.this(a*

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 17:16:05 UTC, bitwise wrote: I was referring specifically to storing gc_malloc'ed pointers on the stack, meaning that I'm calling a C++ function on a D call stack, and storing the pointer as a local var in the C++ function before returning it to D. The more I

Re: returning D string from C++?

2017-08-06 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 6 August 2017 at 16:23:01 UTC, bitwise wrote: So I guess you're saying I'm covered then? I guess there's no reason I can think of for the GC to stop scanning at the language boundary, let alone any way to actually do that efficiently. It's not something you can rely on. If the

Re: How a class can know the current reference of itself?

2017-08-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 August 2017 at 09:58:34 UTC, Mike Parker wrote: Also, class references are *already* references, so you don't need to declare the function parameters as ref. Finally, although this is not an error, @property has no effect on member variables. It only applies to member functions.

Re: How a class can know the current reference of itself?

2017-08-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 August 2017 at 09:38:59 UTC, Pippo wrote: I'm trying to do something like this: module mylib.classA; class A { @property string myproperty; void function(ref A a) callToMyFunction; void myfunction() { callToMyFunction(ref this); } } module

Re: It makes me sick!

2017-07-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 13:39:42 UTC, Arafel wrote: I know this page is not the MAIN "download" [2] page, but it's both reached from the "About" link, and as the first google hit for "dlang download windows", so it should be kept as up to date as possible. [1]:

Re: It makes me sick!

2017-07-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 12:48:37 UTC, Grander wrote: On Friday, 28 July 2017 at 12:40:27 UTC, rjframe wrote: On Fri, 28 Jul 2017 05:14:16 +, FoxyBrown wrote: You can make any claim you want like: "The end user should install in to a clean dir so that DMD doesn't get confused and load

Re: It makes me sick!

2017-07-27 Thread Mike Parker via Digitalmars-d-learn
On Friday, 28 July 2017 at 00:28:52 UTC, FoxyBrown wrote: You are not being very logical. The zip file as N files in it. No matter what those files are, it should be a closed system. That is, if I insert or add(not replace) M file to the directory structure it should not break D, period!

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 16:27:57 UTC, WhatMeWorry wrote: On Wednesday, 26 July 2017 at 02:31:33 UTC, Mike Parker wrote: With static arrays, the memory for the elements if part of the array itself, so it is counted in the size. For dynamic arrays, it is not. For .sizeof to report the

Re: I feel the dynamic array .sizeof property is kind of a bait and switch

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: Static Arrays have property .sizeof which returns the array length multiplied by the number of bytes per array element. Dynamic Arrays have property .sizeof which returns the size of the dynamic array reference, which is 8 in

Re: Append to dynamic array that was allocated via calloc

2017-07-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 25 July 2017 at 12:40:13 UTC, John Burton wrote: I can create a "slice" using non-gc allocated memory. int* ptr = cast(int*)calloc(int.sizeof, 10); int[] data = ptr[0..10]; If I don't want a memory leak I have to call free(ptr) somewhere as it won't be GC collected

Re: VibeD - undefinded identifier

2017-07-23 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 23 July 2017 at 15:23:25 UTC, holo wrote: this(auto tmp) You need to specify a type here instead of using auto.

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:11:27 UTC, Mike Parker wrote: On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 12:16:46 UTC, John Burton wrote: Looks like it's https://wiki.dlang.org/DIP22 that changed this Specifically, it was fixed in DMD 2.071.0 released in April of last year: http://dlang.org/changelog/2.071.0.html#dip22

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 12:11:38 UTC, John Burton wrote: On Wednesday, 19 July 2017 at 12:05:09 UTC, Kagamin wrote: Try a newer compiler, this was fixed recently. Hmm it turns out this machine has 2.0.65 on which is fairly ancient. I'd not realized this machine had not been updated.

Re: C style 'static' functions

2017-07-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 July 2017 at 11:52:09 UTC, John Burton wrote: lib1.d private void init() { // init function used only as an implementation detail } void mything() { init(); } lib2.d - void init() { // init function meant to be used as part of the module

Re: ddox filters out my doc

2017-07-15 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 15 July 2017 at 08:29:52 UTC, Jean-Louis Leroy wrote: My module has a name in dub.sdl. No, it does not. That's the name of the DUB project. The module in this case is source/methods.d. I've never used ddox, but based on what I see in the readme and on looking at the ddox source

Re: Why no offsetof for static struct?

2017-07-10 Thread Mike Parker via Digitalmars-d-learn
On 7/11/2017 6:14 AM, FoxyBrown wrote: On Monday, 10 July 2017 at 20:13:46 UTC, Adam D. Ruppe wrote: No, it isn't. Static members are stored in an entirely different place than non-static members. They are really just global variables in memory with their in-source name being nested

Re: rdmd vs dmd WRT static constructors

2017-07-08 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 9 July 2017 at 02:57:54 UTC, Andrew Edwards wrote: $ rdmd statmain.d stat1.d stat2.d // outputs nothing... Bug or intended behaviour? rdmd takes the first D file you give it, follows its import tree, and compiles all the modules found there. Anything on the command line after

Re: Need simple sound

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

Re: AutoDLL

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

Re: AutoDLL

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

Re: dub + local dependencies

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

Re: dub + local dependencies

2017-07-05 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 5 July 2017 at 15:34:36 UTC, Jolly James wrote: WARNING: A deprecated branch based version specification is used for the dependency xyz. Please use numbered versions instead. Also note that you can still use the dub.selections.json file to override a certain dependency to use a

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 13:19:37 UTC, Guillaume Piolat wrote: https://forum.dlang.org/post/pmulowxpikjjffkrs...@forum.dlang.org Not an issue with DerelictUtil, an issue with the strategy of closing resources in GC with this case. Derelict loaders work-around this by not unloading

Re: Advice wanted on garbage collection of sockets for c++ programmer using D

2017-06-28 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 09:16:22 UTC, Guillaume Piolat wrote: So far everyone is ignoring my example when A needs B to be destroyed. This happens as soon as you use DerelictUtil for example. What's the issue with DerelictUtil?

Re: Relative lflag paths in dub on Windows

2017-06-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 June 2017 at 00:16:23 UTC, Mike Parker wrote: On Tuesday, 27 June 2017 at 19:07:49 UTC, You have to specify the appropriate linker option, e.g. -L-option. For gcc, that happens to -L, so you get -L-L. For optlink it's +something and for the MS linker it's /something. I'm on

Re: Relative lflag paths in dub on Windows

2017-06-27 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 27 June 2017 at 19:07:49 UTC, jmh530 wrote: Is it possible to set relative -L paths on dub for Windows? Absolute paths work fine, just can't get relative paths working. I was looking at the thread here https://forum.dlang.org/post/dkwqrwzwqbrnaamlv...@forum.dlang.org and came up

Re: Linking external *.lib files

2017-06-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 17 June 2017 at 00:37:18 UTC, Jolly James wrote: Unfortunately, the public DUB package requires to be linked with the libs from pkgBASE/lib. What do I have to add to pkgBASE's dub.json? Side-note: the lib/ should not be moved for portability reasons if this is possible My

Re: brew install dmd

2017-06-10 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 June 2017 at 01:30:37 UTC, Joel wrote: but still 2.074.0 (not 74.1) Joels-MacBook-Pro:Testing joelchristensen$ dmd DMD64 D Compiler v2.074.0 It's probably related to this: http://forum.dlang.org/post/abyacihlxtcphnhzi...@forum.dlang.org

Re: D for Web Development?

2017-06-08 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 8 June 2017 at 07:32:44 UTC, Michael Reiland wrote: - Is vibe.d the recommended way of doing web work? Yes - Is that book worth purchasing? Yes - Does D have a good library for accessing Postgres? I see several listed but I don't know what the most stable would be for

Re: Question on @nothrow

2017-05-31 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 08:18:07 UTC, Vasileios Anagnostopoulos wrote: Hi, after reading various articles bout the "supposed" drawbacks of checked exceptions I started to have questions on @nothrow. Why there exists and not a @throws annotation enforced by the compiler? I understand

Re: The syntax of sort and templates

2017-05-26 Thread Mike Parker via Digitalmars-d-learn
On Friday, 26 May 2017 at 09:59:26 UTC, zakk wrote: My questions are: 1) Why is D making using of the binary ! operator, which as far as I understand introduces a template? The ! operator *instantiates* a template. Whenever you need to specify compile-time arguments to match the template

Re: [OT] #define

2017-05-22 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 May 2017 at 18:44:10 UTC, Andrew Edwards wrote: There isn't any Windows specific section. Every function pointer in the library is decorated in one of the following two forms void (APIENTRY *NAME)(PARAMS) or void (APIENTRYP NAME)(PARAMS) Sorry, I worded that

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-22 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 May 2017 at 14:11:35 UTC, Jerry wrote: are you aware of https://github.com/Extrawurst/DerelictImgui ? Not everyone likes the set of 'derelict' libraries. Especially if you need to statically link to a library. Some of the Derelict packages in the DerelictOrg repo (the SDL2,

Re: [OT] #define

2017-05-22 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 May 2017 at 16:37:51 UTC, Andrew Edwards wrote: Specific context at the following links: https://github.com/glfw/glfw/blob/66ff4aae89572419bb130c5613798e34d7521fc7/deps/glad/glad.h#L24-L48 APIENTRY is typically defined in Windows headers to set the stdcall calling

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 21 May 2017 at 11:42:02 UTC, Mike Parker wrote: On Sunday, 21 May 2017 at 10:53:42 UTC, Igor wrote: Dynamic libraries are not yet supported as dependencies - building as static library. I see. And I'm not surprised. DLL support on Windows (at least in DMD, not sure about LDC)

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 21 May 2017 at 10:53:42 UTC, Igor wrote: Dynamic libraries are not yet supported as dependencies - building as static library. I see. And I'm not surprised. DLL support on Windows (at least in DMD, not sure about LDC) is still not where it needs to be. I don't know how much has

Re: Why is DUB not passing dll.def file to linker

2017-05-21 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 21 May 2017 at 09:37:56 UTC, Igor wrote: If I now run dub build in main project both projects compile and work together, but if I run dub build -ax86_64 only main project is built as 64bit while dll project is still being built as 32bit. Does anyone have a suggestion how can I make

Re: Why is DUB not passing dll.def file to linker

2017-05-20 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 20 May 2017 at 20:26:29 UTC, Igor wrote: So my question is if the fix is so simple what are the reasons it isn't implemented? Am I missing something? I don't know, but you could always submit a PR or an enhancement request.

Re: Why is DUB not passing dll.def file to linker

2017-05-20 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 20 May 2017 at 19:53:16 UTC, Igor wrote: There is no mention of dll.def file. Add a "sourceFiles" directive: "sourceFiles-windows" : ["dll.def"] See the comments at the following: https://github.com/dlang/dub/issues/575 https://github.com/dlang/dub/pull/399

Re: How to setup DLL and EXE projects in one VS solution

2017-05-18 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 18 May 2017 at 07:53:02 UTC, Igor wrote: I tried just adding import paths to project and to di files and although compilation passes I still get link errors like: error LNK2019: unresolved external symbol _D10handmade_h10game_input6__initZ (handmade_h.game_input.__init)

Re: Using the same name for diffrent entities

2017-05-01 Thread Mike Parker via Digitalmars-d-learn
On Monday, 1 May 2017 at 14:01:19 UTC, Noy wrote: Hello, Is it possible to use the same name for different entities? For example calling a variable and a class\function by the same name. Symbols declared in the same scope must be unique. For example: ``` module foo; int bar; void bar();

Re: htod for linux

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 12:04:02 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand.

Re: htod for linux

2017-04-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html

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

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

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

Re: Dub and compilation

2017-04-11 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

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

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