Re: how to link self made lib using dub

2018-07-06 Thread Flaze07 via Digitalmars-d-learn
On Friday, 6 July 2018 at 21:13:37 UTC, Timoses wrote: Shouldn't this be 'import output'? nah, because I didn't import source directly, I import experiment so in order to use it, I do source/output.d, which when importing module means, source.output and this '...\\experiment\\source\\'? (I'm

Re: How to use LLD linker?

2018-07-06 Thread SrMordred via Digitalmars-d-learn
Well, since its VS 2017 installer, eventually I hit all the components needed to install it properly. Now its working. Thanks 0xEAB for the tip about the Windows SDK too :)

Re: How to use LLD linker?

2018-07-06 Thread SrMordred via Digitalmars-d-learn
Delete everything, installed everything again, the installation failed to set the proper PATH to MS link.exe, so i put it by hand and now get: fatal error LNK1104: cannot open file 'libcmt.lib' Frustrating.

Re: how to link self made lib using dub

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 17:08:48 UTC, Flaze07 wrote: [...] then, I made a project, with this main in this path : Z:\programming\D\experimentLib\source\main.d it contains this module main; import std.stdio; import source.output; Shouldn't this be 'import output'? void main( string[]

Re: How to use LLD linker?

2018-07-06 Thread SrMordred via Digitalmars-d-learn
On Friday, 6 July 2018 at 19:36:05 UTC, 0xEAB wrote: On Friday, 6 July 2018 at 03:48:04 UTC, SrMordred wrote: Well I just installed the VS 2017 to try the ldc and get (maybe) the same error. You didn't forget to install the Windows SDK with it, did you? Yep I forgot xD It fixed the PATHs

Memory corruption with COM object

2018-07-06 Thread Rene Zwanenburg via Digitalmars-d-learn
I've been staring at this problem the past few hours without making any progress. But I feel like I'm overlooking something obvious.. Using Adam's comhelpers, I've made a JSON plugin for LogParser. However after running for a bit it'll crash with signs of memory corruption. My guess was

Re: How to use LLD linker?

2018-07-06 Thread 0xEAB via Digitalmars-d-learn
On Friday, 6 July 2018 at 03:48:04 UTC, SrMordred wrote: Well I just installed the VS 2017 to try the ldc and get (maybe) the same error. You didn't forget to install the Windows SDK with it, did you?

Re: How to use LLD linker?

2018-07-06 Thread 0xEAB via Digitalmars-d-learn
On Friday, 6 July 2018 at 17:32:09 UTC, SrMordred wrote: On Friday, 6 July 2018 at 10:55:47 UTC, Rainer Schuetze wrote: On 06/07/2018 05:48, SrMordred wrote: [...] The problem is that the Digital Mars linker is called but the Microsoft linker is run, because they share the same name

Re: How to use LLD linker?

2018-07-06 Thread SrMordred via Digitalmars-d-learn
On Friday, 6 July 2018 at 10:55:47 UTC, Rainer Schuetze wrote: On 06/07/2018 05:48, SrMordred wrote: [...] The problem is that the Digital Mars linker is called but the Microsoft linker is run, because they share the same name link.exe. For dmd/x64/32mscoff or LDC in general the latter is

how to link self made lib using dub

2018-07-06 Thread Flaze07 via Digitalmars-d-learn
I have been trying to link self made .lib, and have tried to use it several times, I failed.. so, here I have a file in this path : Z:\programming\D\usefulFiles\experiment\source\output.d it has module output; class Output { public: static void write( string msg ) { import

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 16:24:03 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote: [...] While writing I realized that the following is even the case without the 'ref' parameter: The caller of the setter will still be able to change the content of your private data

Re: immutable / inout / pure headaches

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:44:28 UTC, Steven Schveighoffer wrote: I'm long overdue for an inout article... I can point you at my talk from 2016: https://www.youtube.com/watch?v=UTz55Lv9FwQ Thanks, will definitely take a look when I get home. I never really used 'pure' and just now

Re: Passing a reference to a returned reference

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:51:34 UTC, Michael wrote: Also, yes, I am using the setter method to play around with the precision of the double values, and do some normalising. While writing I realized that the following is even the case without the 'ref' parameter: The caller of the setter will

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:57:27 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote: This is definitely to do with my use of the setter syntax, which maybe I am misunderstanding? Because if I change it to a normal function call like so:

Re: Passing a reference to a returned reference

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:33:18 UTC, Michael wrote: This is definitely to do with my use of the setter syntax, which maybe I am misunderstanding? Because if I change it to a normal function call like so: a.beliefs(Operator.create()); then it complains if I use ref, and doesn't complain

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:37:25 UTC, Timoses wrote: On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote: class Agent { private { double[int] mDict; } // Setter: copy void beliefs(ref double[int] dict) { import std.stdio : writeln;

Re: immutable / inout / pure headaches

2018-07-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/6/18 11:22 AM, Timoses wrote: On Friday, 6 July 2018 at 14:28:39 UTC, Steven Schveighoffer wrote: inout is not a compile-time wildcard, it's a runtime one. So it doesn't know how to convert an immutable to an inout. Essentially, inside this function, the compiler has no idea whether the

Re: Passing a reference to a returned reference

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote: class Agent { private { double[int] mDict; } // Setter: copy void beliefs(ref double[int] dict) { import std.stdio : writeln; writeln("Setter function."); this.mDict = dict; }

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 15:14:01 UTC, Michael wrote: On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote: [...] I'm just trying to do that now. Here is what I have in terms of code: [...] This is definitely to do with my use of the setter syntax, which maybe I am

Re: immutable / inout / pure headaches

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:28:39 UTC, Steven Schveighoffer wrote: inout is not a compile-time wildcard, it's a runtime one. So it doesn't know how to convert an immutable to an inout. Essentially, inside this function, the compiler has no idea whether the real thing is an immutable, const,

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:50:39 UTC, Ali Çehreli wrote: On 07/06/2018 07:36 AM, Michael wrote: > but not in > my case, if this is a weird edge-case with setter member functions? This is all very interesting but I'm dying to see the code. :) Can you change Timoses's code to demonstrate your

Re: Passing a reference to a returned reference

2018-07-06 Thread Ali Çehreli via Digitalmars-d-learn
On 07/06/2018 07:36 AM, Michael wrote: > but not in > my case, if this is a weird edge-case with setter member functions? This is all very interesting but I'm dying to see the code. :) Can you change Timoses's code to demonstrate your case? Ali

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote: This works for me: auto create() { string[int] dict; dict[2] = "hello"; return dict; } void modifyNoRef(string[int] m) { writeln("Address not ref: ", ); m[0] = "modified";

Re: Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
On Friday, 6 July 2018 at 14:11:42 UTC, Timoses wrote: On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote: static auto ref consensus( ... ) `auto ref` infers the return type from the return statement [1]. So it's not necessarily returning a ref type. However, I don't think this matters

Re: immutable / inout / pure headaches

2018-07-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/6/18 7:10 AM, Timoses wrote: I dared once again getting into immutable by adding an "immutable" keyword which causes a chain of actions to be taken. I feel like I'm lost in a jungle of immutable, inout and pure (perhaps more will join the party...). To start off, why does this not work?

Re: Passing a reference to a returned reference

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Friday, 6 July 2018 at 13:13:43 UTC, Michael wrote: static auto ref consensus( ... ) `auto ref` infers the return type from the return statement [1]. So it's not necessarily returning a ref type. However, I don't think this matters if the only concern you have is that the setter

Passing a reference to a returned reference

2018-07-06 Thread Michael via Digitalmars-d-learn
Hello, I'm a little confused about what is actually happening when I try to pass a reference, returned by a method that produces the object (associative array), to a setter method which expects a reference. What seems to be happening is that it simply does nothing, as if the setter method is

Re: Static member function returning immutable slice; compiler error: without this cannot be immutable

2018-07-06 Thread Ivo Maffei via Digitalmars-d-learn
Ok thanks to everyone for their help. So I tried what you suggested and so the problem was bracketing. For future reference, the above code can be fixed into this: class Foo { private static Foo[] fooSlice; //private static slice static const(Foo[]) getFooList() { //static method

Re: immutable / inout / pure headaches

2018-07-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, July 06, 2018 11:10:27 Timoses via Digitalmars-d-learn wrote: > I dared once again getting into immutable by adding an > "immutable" keyword which causes a chain of actions to be taken. > I feel like I'm lost in a jungle of immutable, inout and pure > (perhaps more will join the

immutable / inout / pure headaches

2018-07-06 Thread Timoses via Digitalmars-d-learn
I dared once again getting into immutable by adding an "immutable" keyword which causes a chain of actions to be taken. I feel like I'm lost in a jungle of immutable, inout and pure (perhaps more will join the party...). To start off, why does this not work? class Test {

Re: How to use LLD linker?

2018-07-06 Thread Rainer Schuetze via Digitalmars-d-learn
On 06/07/2018 05:48, SrMordred wrote: On Saturday, 30 June 2018 at 10:48:49 UTC, Suliman wrote: Correct me if I am wrong, but I have read news that dmd now can be used without C++ Build Tools. I trying to build simple project. And getting Error: Warning: no Visual C++ installation

Re: Function Template for Dynamic Parameter

2018-07-06 Thread Timoses via Digitalmars-d-learn
On Thursday, 5 July 2018 at 16:23:36 UTC, vino.B wrote: Hi All, Request your help on the below code auto coCleanFiles(T ...) (T FFs) { auto dFiles = Array!(Tuple!(string, SysTime))(dirEntries(FFs, SpanMode.depth).map!(a => tuple(a.name, a.timeCreated))); return dFiles; } void

Re: How to use LLD linker?

2018-07-06 Thread Suliman via Digitalmars-d-learn
Well I just installed the VS 2017 to try the ldc and get (maybe) the same error. dub run --config=application --arch=x86_64 --build=debug --compiler=ldc2 Performing "debug" build using ldc2 for x86_64. lib ~master: building configuration "application"... OPTLINK (R) for Win32 Release 8.00.17