Re: exporting function from betterc to windows dll

2020-03-14 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 14 March 2020 at 20:53:45 UTC, Abby wrote: I would like to export some functions from my bettec dll for dotnet core application in windows. Right now I have compiled dll using dmd v2.091.0-dirty simply by ´dub build´ this is the function I have extern(C) char*

Re: Is it possible to dynamically load a @safe function from a shared library ?

2020-03-13 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 March 2020 at 16:11:53 UTC, wjoe wrote: On Friday, 13 March 2020 at 16:04:06 UTC, Mike Parker wrote: On Friday, 13 March 2020 at 15:16:06 UTC, wjoe wrote: bindSymbol(, "VersionOfAPI"); } Is it possible to convince the compiler to look the other way while binding @safe

Re: Is it possible to dynamically load a @safe function from a shared library ?

2020-03-13 Thread Mike Parker via Digitalmars-d-learn
On Friday, 13 March 2020 at 15:16:06 UTC, wjoe wrote: bindSymbol(, "VersionOfAPI"); } Is it possible to convince the compiler to look the other way while binding @safe functions from the plugin ? It probably has nothing to do with @safe, but is because of the void**.

Re: total newbie + IDE

2020-02-09 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 9 February 2020 at 22:10:57 UTC, solnce wrote: Personally I feel this is more about lack of the vision, as Alexandrescu once said. Now it feels like D is mostly the compiler, but I think, that having one big mega project (like IDE+RAD) could give a new breath and significance to D

Re: readline / Gnu readline

2020-01-30 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 30 January 2020 at 06:27:36 UTC, Michael wrote: On Thursday, 30 January 2020 at 06:15:54 UTC, Mike Parker wrote: Is your source file named rl.d? And are you running dmd in the source file's directory? No, I did not. Changed it now and it works with dmd. Great! Tried the same

Re: readline / Gnu readline

2020-01-29 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 30 January 2020 at 06:12:32 UTC, Michael wrote: When 'dmd rl -L-lreadline' in the command line. I do get the following error: Error: module rl is in file 'rl.d' which cannot be read. So probably I'm missing something unfortunately I don't know what. Is your source file named

Re: How change window Backgound Color when press a Button when using "ResEdit Resource Editor" to design?

2020-01-29 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 30 January 2020 at 04:31:46 UTC, Marcone wrote: I am very noob. Can you send me the code? You've been asking a lot of questions about the Win32 API. This is a D programming forum, not a Win32 API forum. I'm sure people are generally happy to help point you in the right

Re: weekly news?

2020-01-23 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 15:44:10 UTC, Adam D. Ruppe wrote: Or delete all that wordpress junk and make something in D :P I intend to delete all that Wordpress junk and go completely static eventually.

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 06:27:31 UTC, Mike Parker wrote: Apparently so. Firefox shows me a 404 for the URL with the parameter ?relatedposts=1. Must be something in the Wordpress settings triggering the fetch. Maybe with Jetpack. I wonder why Chrome doesn't show it. I'll look into

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 06:23:14 UTC, Mike Parker wrote: I'm not getting any 404s in the network tab in Chrome's dev tools. Even on a reload. Most everything is 200, with a handful of 204s. A couple are 302 or 304, and there's one 101. Am I missing something? Apparently so.

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 23 January 2020 at 00:58:10 UTC, Adam D. Ruppe wrote: On Thursday, 23 January 2020 at 00:52:10 UTC, Mike Parker wrote: Got any examples? No one has reported this to me before and I haven’t encountered a 404 in a while. Almost all of them! Hit F12 to open browser tools and notice

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 23:08:09 UTC, Russel Winder wrote: On Wed, 2020-01-22 at 22:48 +, Mike Parker via Digitalmars-d-learn wrote: […] To D Blog has an RSS feed: http://dlang.org/blog/index.php/feed/ […] This URL doesn't seem to work for me. It redirects to: https

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 23:23:41 UTC, Adam D. Ruppe wrote: Several pages on the official blog give code 404 even though they work. Your RSS reader probably just isn't checking the code, but the browser is. These should all be fixed on the server... could be hurting seo too. Got

Re: weekly news?

2020-01-22 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 22 January 2020 at 18:53:49 UTC, mark wrote: Is there a "D weekly news" I could do an email subscription to? Or at least a way to get notified by email when a new item appears on https://dlang.org/blog/ ? This Week in D linked above is great for a weekly summary. To D Blog has

Re: Some comments on learning D using the tour

2020-01-15 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 15 January 2020 at 20:06:01 UTC, mark wrote: However, what I really miss is a contents page so that I can look at each topic and jump back when I want to recap something. Please submit an enhancement request: https://github.com/dlang-tour/core/issues For example, I haven't

Re: books for learning D

2020-01-13 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:58:51 UTC, mark wrote: Both those books are published by Packt who normally have no quality control at all as I've discovered to my cost. However It's hit and miss in my experience. I've picked up some utter crap from them, but I've also found some real

Re: Win32 Api: How create Open/"Save as" Dialog?

2020-01-10 Thread Mike Parker via Digitalmars-d-learn
On Friday, 10 January 2020 at 15:06:07 UTC, Marcone wrote: Very complicated. Can you send me the simple clear code? https://docs.microsoft.com/en-us/windows/win32/dlgbox/using-common-dialog-boxes

Re: Default values in derived class

2019-12-28 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 28 December 2019 at 20:22:51 UTC, JN wrote: import std.stdio; class Base { bool b = true; } class Derived : Base { bool b = false; } void main() { // 1 Base b = new Derived(); writeln(b.b); // true // 2 Derived d = new Derived(); writeln(d.b); // false }

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-25 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 25 December 2019 at 10:57:45 UTC, Ron Tarrant wrote: On Tuesday, 24 December 2019 at 16:43:06 UTC, Mike Parker wrote: But now that VS Code's performance is within my tolerance range Just curious what you mean by this, Mike. For a while, typing in VS Code was clunky compared to

Re: What kind of Editor, IDE you are using and which one do you like for D language?

2019-12-24 Thread Mike Parker via Digitalmars-d-learn
On Monday, 23 December 2019 at 20:45:53 UTC, TheGag96 wrote: I've loved Sublime for years. I use it for everything, really. So pretty, so fast. I really like Sublime, too. Paid for it. But now that VS Code's performance is within my tolerance range, the built-in console makes the

Re: array of functions/delegates

2019-12-24 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 24 December 2019 at 13:13:12 UTC, MoonlightSentinel wrote: On Tuesday, 24 December 2019 at 10:40:16 UTC, Mike Parker wrote: struct S {} void f1(S s) {} void f2(S s) {} alias Func = immutable(void function()); immutable Func[2] funcs = [cast(Func), cast(Func)]; Though, it's not

Re: Static linking, specifying binary and test-library folder

2019-12-24 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 24 December 2019 at 05:51:37 UTC, Adnan wrote: Hello, how does one: 1. Force static linking (build with `-defaultlib` flag) Generally, when you don't see a buildOption in the docs for the compiler flag you want, use dflags. https://dub.pm/package-format-json.html 2. Specify

Re: array of functions/delegates

2019-12-24 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 24 December 2019 at 07:37:02 UTC, Rumbu wrote: I am trying to create an array of functions inside a struct. struct S { void f1() {} void f2() {} alias Func = void function(); immutable Func[2] = [, ] } What I got: Error: non-constant expression '' Tried also with

Re: unicode characters are not printed correctly on the windows command line?

2019-12-22 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 22 December 2019 at 06:25:42 UTC, rikki cattermole wrote: On 22/12/2019 7:11 PM, moth wrote: is there any function i can call or setting i can adjust to get D to do the same, or do i have to wait for something to be fixed in the language / compiler itself? Not a bug. This

Re: How to create a custom max() function without the ambiguity error.

2019-12-06 Thread Mike Parker via Digitalmars-d-learn
On Friday, 6 December 2019 at 21:02:53 UTC, realhet wrote: Here's my latest attempt on EXTENDING std.algorithm.max's functionality with a max operation on a custom type. The type is the GLSL vec2 type which does the max operation component-wise. The D std implementation uses the < operator,

Re: Unexpectedly nice case of auto return type

2019-12-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 December 2019 at 10:06:22 UTC, Mike Parker wrote: On Tuesday, 3 December 2019 at 10:03:22 UTC, Basile B. wrote: That's interesting details of D developement. Since you reply to the first message I think you have not followed but in the last reply I told that maybe we should be

Re: Unexpectedly nice case of auto return type

2019-12-03 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 3 December 2019 at 10:03:22 UTC, Basile B. wrote: That's interesting details of D developement. Since you reply to the first message I think you have not followed but in the last reply I told that maybe we should be able to name the type of null. I think this relates to TBottom

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 05:15:10 UTC, cartland wrote: No MS installed. Just using DMD. - dub -a x86_mscoff --force -v : So please try it without dub dmd -m32mscoff x.d If that works, add some debug flags like dub does: dmd -m32mscoff -debug -g x.d And see what happens.

Re: Exceptions on Windows being "swallowed"

2019-11-26 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 02:48:53 UTC, cartland wrote: Trying out exception handling. When an exception occurs, program seems to just exit. dub -a x86_mscoff I compiled it with dmd and ran it directly from the command line and it worked fine: C:\dev\D\scratch>ex finally catch

Re: how to implement a function in a different D source file

2019-11-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 03:55:24 UTC, mipri wrote: On Tuesday, 26 November 2019 at 03:06:52 UTC, Omar wrote: the page here https://dlang.org/spec/function.html suggests you can implement a function in a different file ... mentioned the endeavour of no-bodied-functions as a way of

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:45:21 UTC, Mike Parker wrote: On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific

Re: How to simulate Window's "Press any key to continue..."

2019-11-21 Thread Mike Parker via Digitalmars-d-learn
On Friday, 22 November 2019 at 04:22:07 UTC, FireController#1847 wrote: Right, but readln will only wait until the user presses the delimiter (by default Enter/Return). I want it to wait until ANY key is pressed, not a specific key The documentation for std.stdio.File shows two functions

Re: csvReader & specifying separator problems...

2019-11-14 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 14 November 2019 at 12:25:30 UTC, Robert M. Münch wrote: From the docs, which I find extremly hard to understand: auto csvReader(Contents = string, Malformed ErrorLevel = Malformed.throwException, Range, Separator = char)(Range input, Separator delimiter = ',', Separator quote 

Re: How to import & export modules

2019-11-10 Thread Mike Parker via Digitalmars-d-learn
On Monday, 11 November 2019 at 01:28:54 UTC, userTY wrote: import all; // can see App, Form and Button exported (public) symbols --- The approach of using an "all" module is an old hack that is no longer necessary. Today, the way to approach is to use a "package module".

Re: A question about postblit constructor

2019-11-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: [...] Yep, it is obvious that my code is wrong. s1 and s2 point to the same memory

Re: A question about postblit constructor

2019-11-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 08:47:05 UTC, Ferhat Kurtulmuş wrote: value of int which is 0. I wonder how new memory is allocated without an explicit malloc here. Sorry for this noob question in advance, I could not find any doc mentioning a similar case. int* vals =

Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:01:27 UTC, Vinod K Chandran wrote: Hi all, I just found that DFL gui library very interesting. But after some searching, i can see that DFL is inactive and there is few other forks for it. So this is my question - Which fork is good for a gui development in

Re: Which is the active fork in DFL gui library ?

2019-11-03 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 3 November 2019 at 07:06:12 UTC, Mike Parker wrote: Here's an example, winhello.d, that should work with all of the following command lines: Sorry, here's the example: == winhello.d /+ dub.sdl: name "entry" dflags "-L/SUBSYSTEM:WINDOWS" "-L/ENTRY:mainCRTStartup"

Re: D for sciencetific scripting / rapid protoryping

2019-10-22 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 22 October 2019 at 07:40:01 UTC, Prokop Hapala wrote: 1) I'm not speaking about OpenGL and SDL specifically (that was just small example which I tried first) FYI, the BindBC bindings can be configured as dynamic (in which all the of C library functions are declared as function

Re: Any 3D Game or Engine with examples/demos which just work (compile) out of the box on linux ?

2019-10-18 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 19 October 2019 at 00:57:48 UTC, Prokop Hapala wrote: The dmech/demos also seems to be almost running just it somehow cannot find or use my libsdl.so library which it just compiled (it is in 'dmech/demos/lib')

Re: Struct initialization has no effect or error?

2019-10-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 October 2019 at 04:57:44 UTC, mipri wrote: On Thursday, 3 October 2019 at 04:33:26 UTC, Brett wrote: I was trying to avoid such things since X is quite long in name. Not a huge deal... and I do not like the syntax because it looks like a constructor call. It is a constructor

Re: Why is it difficult to reference arrays in structs?

2019-10-02 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 3 October 2019 at 04:32:52 UTC, Brett wrote: Ok, fine! auto r = Now r is a reference, great! No, r is a pointer, not a reference. D does not have reference variables. But now the semantics of using the array completely change and errors abound! Probably because you're

Re: want to know precise GC benchmarks

2019-10-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 October 2019 at 16:24:49 UTC, a11e99z wrote: why I want to know such info? CodinGame sometimes use time-limit for bot move for example 100ms, and bot will be disqualified in case no answer Simple solution: don't allocate every frame. The GC only runs when it needs to and it

Re: Help making a game with transparency

2019-09-28 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 28 September 2019 at 13:41:24 UTC, matheus wrote: Ok, I took a look over my old projects and I found exactly what you want, by the way it's from 2012. It uses Derelict 2.0 bindings and will draw a PNG image where you can move around with cursor keys. Murilo, if you do decide to

Re: Help making a game with transparency

2019-09-28 Thread Mike Parker via Digitalmars-d-learn
On Friday, 27 September 2019 at 22:55:22 UTC, Murilo wrote: Ahhh, that clears everything up. I will then leave the program without the transparency and wait until you get around to implement the fixes to it, I am not a developer, I am a scientist, I only use libraries, I don't know how to

Re: Indexed graphics for retro engine?

2019-09-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 18:25:05 UTC, Shadowblitz16 wrote: I wanted to do 4bpp 16 color graphics. and I didn't want to load anything unnecessary in the image like the palette but instead supply it myself as a Color[16]; I see. In that case, I suggest you find some tutorials on

Re: combining libraries into 1 or 1 for each system?

2019-09-19 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 18:28:25 UTC, Shadowblitz16 wrote: I mean I don't want to have multiple dependency dll's but instead just my own dll with the dependencies packed inside. of course dll is only for windows so I would like this done for mac and linux too Then statically

Re: Indexed graphics for retro engine?

2019-09-18 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 03:47:05 UTC, Shadowblitz16 wrote: Is there a way to make a indexed graphics library that can handle importing and exporting true color images? I don't see why not. I would guess something like this could be simulated with pointers and references right?

Re: combining libraries into 1 or 1 for each system?

2019-09-18 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 19 September 2019 at 03:44:28 UTC, Shadowblitz16 wrote: let's say I have a project the relies on multiple packages.. is it possible to combine these libraries into a single one (or 1 per os) for final shipment of a program? I assume you're referring to dub packages, in which case

Re: Make executable archive just like Java's .jar archive?

2019-09-12 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 September 2019 at 12:53:27 UTC, BoQsc wrote: On Thursday, 12 September 2019 at 12:52:48 UTC, BoQsc wrote: Is there a way to archive multiple .d source code files and make that archive executable, or something similar? https://en.wikipedia.org/wiki/JAR_(file_format) A JAR

Re: Using CSS Data from Within My Code

2019-09-12 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 12 September 2019 at 11:40:33 UTC, Ron Tarrant wrote: string myCSS = "tab { background-color: #f2f2f2; }"; enum will work just as well here and without the need for the variable: enum myCSS = "tab { background-color: #f2f2f2; }"; The original error was

Re: Blog Post #69: TextView and TextBuffer Basics

2019-09-10 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 10 September 2019 at 08:29:59 UTC, Ron Tarrant wrote: This morning's discussion covers the basic workings and relationship between the TextView and TextBuffer widgets. Here's the link: https://gtkdcoding.com/2019/09/10/0069-textview-and-textbuffer.html Seriously impressed that

Re: Old code no longer working on any DMD compilers

2019-09-06 Thread Mike Parker via Digitalmars-d-learn
On Friday, 6 September 2019 at 05:59:30 UTC, Jamie wrote: time and fmod is called so it breaks. In case 3, with default struct arguments, I thought that the constructor I have defined was being called, however the default constructor was being called (this()) so fmod wasn't being called.

Re: Is there has an pdf document for Phobos.

2019-09-04 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 12:24:47 UTC, lili wrote: On Wednesday, 4 September 2019 at 04:21:10 UTC, Mike Parker wrote: On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote: Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for

Re: Is there has an pdf document for Phobos.

2019-09-03 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 4 September 2019 at 03:07:18 UTC, lili wrote: Hi: For some reason it too slow that some times i visited dlang.org, Can admin make a pdf document for download. Documentation is installed with the compiler.

Re: Why is sformat and formattedWrite (appender) allocating GC mem here?

2019-08-31 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 31 August 2019 at 12:07:56 UTC, cc wrote: And what, if anything, can I do to avoid it? import core.stdc.stdio : printf; There are no @nogc versions of the Phobos write* and format functions.

Re: Input/Output multiple values from function

2019-08-27 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 28 August 2019 at 04:19:49 UTC, Jabari Zakiya wrote: I have a function (say func1) that takes 1 input value (an integer number) and outputs 4 values (2 integers and 2 arrays of integers). Then inside another function (say func2) I provide the 1 input to func1 and then want to

Re: D1: Trying to update Juno Library to 1.076

2019-08-23 Thread Mike Parker via Digitalmars-d-learn
On Friday, 23 August 2019 at 16:09:16 UTC, jicman wrote: } That looks like D2 code. I am trying to compile D1 code. I think the linker is not getting something right. You might try declaring the offending functions as extern(Windows) function pointers and then loading them from the

Re: How should I sort a doubly linked list the D way?

2019-08-13 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 22:12:23 UTC, Mirjam Akkersdijk wrote: Though, it left me with some semi-offtopic questions unanswered: (1) Ali, do you mean that from an optimization viewpoint, it's better to keep appending like `nodes ~= ...` instead of setting the length first? I would like

Re: Why is this allowed? Inheritance variable shadowing

2019-08-13 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 13 August 2019 at 04:40:53 UTC, Chris Katko wrote: You can drop this straight into run.dlang.io: import std.stdio; class base{ float x=1;} class child : base {float x=2;} //shadows base variable! void main() { base []array; child c = new child; array ~= c;

Re: How to contact people on the forum

2019-07-24 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 24 July 2019 at 16:37:33 UTC, Greatsam4sure wrote: On Wednesday, 24 July 2019 at 15:56:43 UTC, drug wrote: 24.07.2019 18:51, Greatsam4sure пишет: Good day everyone. I am thinking,  if there is a  way to contact any person on dlang forums through mail or any other means. How do I

Re: Why after writeln the binaryHeap become empty?

2019-06-19 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 19 June 2019 at 06:00:28 UTC, Jonathan M Davis wrote: On Tuesday, June 18, 2019 10:27:46 PM MDT lili via Do you known reason for why Dlang Range are consumed by iterating over them. I this design is strange. If you want an overview of ranges, you can watch this:

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:50:46 UTC, Mike Parker wrote: On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote: If yes, when should one use 'new'? Whenever you need to allocate something from the GC heap. In my experience, it's rare to need it with value types in D. I tend to use it

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 08:47:41 UTC, Mike Parker wrote: If yes, when should one use 'new'? Whenever you need to allocate something from the GC heap. In my experience, it's rare to need it with value types in D. I tend to use it primarily with classes and arrays. Ali's book has an

Re: What is difference between struct and class?

2019-06-03 Thread Mike Parker via Digitalmars-d-learn
On Monday, 3 June 2019 at 07:13:44 UTC, Rnd wrote: I know 'new' is not needed to create instances of structs but can one use 'new'? Yes. It can be used with any value type to allocate a block of memory on the GC heap and return a pointer to that memory: struct Foo { ... } Foo* f = new

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Mike Parker via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: What is the correct way? --DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By default, GC options can only be passed on the command line of

Re: dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-03 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 2 May 2019 at 22:54:20 UTC, Joshua Hodkinson wrote: Hi everyone, I am getting a linker error when compiling with dmd (v2.085.1) when using StrechDIBits from the win32 api. Error 42: Symbol Undefined _StretchDIBits@52 However with ldc (v1.15.0) the program compiles correctly.

Re: Packages / imports & references between modules

2019-04-28 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 28 April 2019 at 11:12:50 UTC, Robert M. Münch wrote: One more problem now showing up, when I do this: A/a.d module A.a; struct myStruct; A/b.d module A.b; struct myStruct {...} A/c.d module A.c; import A; struct

Re: DMD different compiler behaviour on Linux and Windows

2019-04-26 Thread Mike Parker via Digitalmars-d-learn
On Friday, 26 April 2019 at 15:48:51 UTC, Ron Tarrant wrote: On Thursday, 25 April 2019 at 20:38:31 UTC, Mike Parker wrote: If you compile with -m32 on Windows the error goes away. Not trying to be a but it also works with -m64 on Windows. Yes, thanks. That's a typo. -m32, where size_t is

Re: DMD different compiler behaviour on Linux and Windows

2019-04-25 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 25 April 2019 at 20:18:28 UTC, Zans wrote: import std.stdio; void main() { char[] mychars; mychars ~= 'a'; long index = 0L; writeln(mychars[index]); } Why would the code above compile perfectly on Linux (Ubuntu 16.04), however it would produce the following error

Re: Check if function argument can be handled in CT

2019-04-24 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 24 April 2019 at 10:52:58 UTC, Andrey wrote: On Wednesday, 24 April 2019 at 08:28:06 UTC, Basile.B wrote: On Wednesday, 24 April 2019 at 07:53:47 UTC, Andrey wrote: I know about this template. Unfortunally, it doesn't work inside functions. void test(string arg1, string arg2)

Re: Anyone have a Vibe.d Diet Template syntax definition for Sublime?

2019-04-21 Thread Mike Parker via Digitalmars-d-learn
On Monday, 22 April 2019 at 04:12:11 UTC, Andrej Mitrovic wrote: Or perhaps for any other editor so I could adapt it and have syntax highlighting in Sublime when viewing .dt files. Bot dls and code-d have VS Code syntax files for diet templates:

Re: bug in compiles?

2019-04-11 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 11 April 2019 at 22:41:32 UTC, Alex wrote: Seriously? Do you think you have ESP? Your code isn't even close to was talking about ;/ Here is is updated that shows the error. You seem to fail to understand that it is impossible for it to be my code. If you continue to attack

Re: Templates - What's Up with the template keyword?

2019-04-09 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 9 April 2019 at 10:53:49 UTC, Ron Tarrant wrote: On Monday, 8 April 2019 at 14:56:46 UTC, Mike Parker wrote: In the subsequent sections, I show both long and short (eponymous) forms of enum and function templates. In your book, Mike, you stated: Remember, a template is only

Re: Templates - What's Up with the template keyword?

2019-04-08 Thread Mike Parker via Digitalmars-d-learn
On Monday, 8 April 2019 at 12:23:28 UTC, Ron Tarrant wrote: First, the question... In Michael Parker's book, "Learning D," (Packt, 2015) on page 160 he gives an example of a basic template: template MyTemplate(T) { T val; void printVal() { import std.stdio : writeln;

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 07:25:40 UTC, Mike Parker wrote: documentation. Instead, it belongs in the DMD windows documentation. It's currently missing: https://dlang.org/dmd-windows.html#linking The 32-bit COFF support is missing there I mean. It does specifically mention that there are

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 07:10:51 UTC, Robert M. Münch wrote: t. My missing point was, that I didn't expect to work with two different links. And I totally agree, DUB needs to mention this. Make everyones live easy. I don't want to dig through fragmented information, collect and sort all

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 04:32:57 UTC, evilrat wrote: On Tuesday, 5 March 2019 at 03:48:22 UTC, Mike Parker wrote: I stopped using WinMain with D a long time ago. It's not necessary. If you always use `main`, then both linkers will provide you with a console subsystem app by default. That's

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Monday, 4 March 2019 at 18:34:09 UTC, Robert M. Münch wrote: Hi, when compiling a minimal Windows GUI app (using WinMain()) and compiling it with DUB, the 32-bit x86 version is a character subsystem EXE (writeln works) and for x86_64 it's a GUI subsystem EXE (writeln doesn't work). Since

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 02:13:30 UTC, evilrat wrote: This should do for MS linker "lflags-windows-x86_64": ["/SUBSYSTEM:CONSOLE"], "lflags-windows-x86_mscoff": ["/SUBSYSTEM:WINDOWS"] For old optlink x86 it is a bit harder, you need to include special .def file that has

Re: Why is SwitchError an error and how is it unsafe to continue after catching it?

2019-02-24 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 24 February 2019 at 10:53:09 UTC, aliak wrote: Because from what I understand, an Error is something you should not be catching and represents something unrecoverable. And it the docs say that it's unsafe to continue execution. But the following code is very recoverable and I don't

Re: Next steps of approved DIPs

2019-02-20 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 20 February 2019 at 11:52:35 UTC, Peter Particle wrote: In particular I am interested in DIP 1014 but this question can be applied to any approved DIP. Where do I get information about e.g. implementer, implementation state/progress, which DMD version is expected to include it

Re: Is there a way to replace Exception with as a macro in C?

2019-02-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 06:16:59 UTC, Mike Parker wrote: ``` Exception invalidIndexException() { throw new Exception("Index is invalid"); } Eh, that should be: void invalidIndexException() {...}

Re: Is there a way to replace Exception with as a macro in C?

2019-02-18 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 05:50:04 UTC, yisooan wrote: This is allowed. But I want to do the exact same thing in D. I have already tried some expressions with alias? but it doesn't work. alias can't be used for expressions. Would you help me, please? There's nothing exactly

Re: Linux & DMD & GtkD

2019-02-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 February 2019 at 13:35:57 UTC, Ron Tarrant wrote: dmd -de -w -m64 -L+gtkd hello_gtkd_world.d DMD's -L switch means "pass the following flag to the linker". Linker arguments are system-dependent. The + is what you use on Windows to specify the library path when running DMD

Re: How to disable/hide constructor when using factory method?

2019-01-24 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 24 January 2019 at 12:58:15 UTC, JN wrote: Doh. Of course. I feel so dumb. I just had it at @disable this();, then replaced @disable with private without thinking to add {} Give me a nickel for every time I've made an edit like that...!

Re: Interfacing with C libs: weeding through C/C++ macros and such in header files

2019-01-13 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 13 January 2019 at 22:40:57 UTC, Alec Stewart wrote: Example without code; for some reason a macro is defined for the stdlib functions `malloc`, `realloc`, and `free`. Maybe it's just because I don't have any pro experience with C or C++, but that seems a bit excessive. Or I

Re: Libraries, versions, API changes, and Dub

2019-01-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 January 2019 at 10:28:55 UTC, Mike Parker wrote: to set up compile-time versions Compile-time *values* else enum dvbvSupport = DVBVSupport.v114; This, of course, should be = DVBVSupport.v112

Re: Libraries, versions, API changes, and Dub

2019-01-10 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 10 January 2019 at 05:44:22 UTC, Russel Winder wrote: It appears that libdvbv5 has undergone an (unnoticed by me till just now) version change. This raises a general question for creators of D bindings. libdvbv5 has versions 1.12.x, 1.14.x, 1.16.x, etc, following the "odd is

Re: Co-developing application and library

2019-01-05 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 5 January 2019 at 15:17:28 UTC, Mike Parker wrote: On Saturday, 5 January 2019 at 13:01:24 UTC, Russel Winder wrote: Dub seems to have the inbuilt assumption that libraries are dependencies that do not change except via a formal release when you developing an application. Clearly

Re: Co-developing application and library

2019-01-05 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 5 January 2019 at 13:01:24 UTC, Russel Winder wrote: Dub seems to have the inbuilt assumption that libraries are dependencies that do not change except via a formal release when you developing an application. Clearly there is the workflow where you want to amend the library but

Re: Compile time opAssign/@property constraints

2019-01-04 Thread Mike Parker via Digitalmars-d-learn
On Friday, 4 January 2019 at 11:53:41 UTC, Jacob Shtokolov wrote: On Friday, 4 January 2019 at 11:45:24 UTC, Jacob Shtokolov wrote: Here is the simple example: https://run.dlang.io/gist/1a06dd703bea5548ee72b4713a7ce5f6 Sorry, invalid link. Here is a new one: https://run.dlang.io/is/QZ5hLV

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 20:27:44 UTC, Ron Tarrant wrote: On Tuesday, 1 January 2019 at 18:10:49 UTC, Mike Parker wrote: We're using Mivhak Syntax Highlighter on the D Blog. OOTB, or...? I couldn't find a list of supported languages. It supports D out of the box.

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 14:46:15 UTC, Ron Tarrant wrote: I've found a ton of syntax highlighter plugins for WordPress, but none that admit to supporting D. Anyone know of one? Or, short of that, perhaps a different site build/management tool (read: not WordPress) with decent D syntax

Re: Doubt about this book: The D Programming Language

2018-12-17 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 16 December 2018 at 22:02:44 UTC, bachmeier wrote: Sometimes Packt has sales and you can get them pretty cheap. All Packt ebooks are on sale for $5 right now, so this is a great time to pick up both books along with Kai's Vibe.d book.

Re: Doubt about this book: The D Programming Language

2018-12-16 Thread Mike Parker via Digitalmars-d-learn
On Monday, 17 December 2018 at 06:08:58 UTC, Jani Hur wrote: Publish dates are 2014 and 2015. How much the language has changed/evolved since then and how much it will evolve in future ? So are these books relevant today and still next two years ? There haven't been any changes in the

Re: How may I tell dub where to find a C library for linking?

2018-12-10 Thread Mike Parker via Digitalmars-d-learn
On Monday, 10 December 2018 at 15:38:24 UTC, Pab De Nápoli wrote: 1) Setting the LD_LIBRARY_PATH environment variable with export LD_LIBRARY_PATH=/usr/lib/llvm-6.0/lib/ and using "libs" : ["LLVM-6.0"] in dub.json. (this is somewhat nasty, it would be nice to keep all the information

Re: dip1000 rule 5

2018-11-27 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 27 November 2018 at 08:56:47 UTC, sclytrack wrote: --- How is a person able to understand this DIP? ./dmd -betterC -dip1000 test.d I'll repeat: the DIP does not currently match the implementation. I was not involved in any of it and have no idea what the diff actually is.

Re: dip1000 rule 5

2018-11-25 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 November 2018 at 21:22:09 UTC, sclytrack wrote: Did DIP1000 go through any review process? I'm seeing it is a draft. The previous DIP manager marked DIPs as Draft while they were under review. I don't use that anymore. I left DIP1000 untouched after I took over, however.

Re: D is supposed to compile fast.

2018-11-25 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 25 November 2018 at 22:00:21 UTC, Chris Katko wrote: So 1) I have to compile manually, then link. Except that also runs the files every time even if they're up-to-date. Is that normal behavior for C/C++? Yes, C and C++ compilers behave the same way. #1 How to I only build

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