Re: Compile-time associative array

2019-03-20 Thread boolangery via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 23:41:58 UTC, Steven Schveighoffer wrote: On 3/19/19 7:22 PM, Bastiaan Veelo wrote: Beware that a CT AA stores its elements in a different order than a RT AA, which you would notice in a foreach, for example. Yes, this is the issue -- the runtime AA depends on dru

How to write a class proxy ?

2019-03-20 Thread boolangery via Digitalmars-d-learn
Hi, What is the best way to write a class proxy ? I need to intercept attribute access. Example: The user write a PODO: class User { string name; } Then he use my library: auto user = mylib.get!User(); // return a proxy here writeln(user.name); // intercept user.name access (how to do

Re: How to write a class proxy ?

2019-03-20 Thread Alex via Digitalmars-d-learn
On Wednesday, 20 March 2019 at 08:16:22 UTC, boolangery wrote: Hi, What is the best way to write a class proxy ? I need to intercept attribute access. Example: The user write a PODO: class User { string name; } Then he use my library: auto user = mylib.get!User(); // return a proxy her

Re: Compile-time associative array

2019-03-20 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 20 March 2019 at 08:11:27 UTC, boolangery wrote: Got it ! Thank you, so I need to write: enum string[string] CtfeFoo = ["foo" : "bar"]; static immutable string[string] Foo; static this() { Foo = CtfeFoo; } string ctfeableFunction() { if (__ctfe) return CtfeFoo["fo

Re: build 32-bit library on 64-bit OS

2019-03-20 Thread DFTW via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 21:20:24 UTC, kinke wrote: On Tuesday, 19 March 2019 at 20:56:47 UTC, DFTW wrote: What package did you mean? that libphobos2 on the error messages from the ld? I'm using dmd/dub on Ubuntu 18. libphobos2-ldc-shared.so is definitely from LDC. I hadn't noticied it

Re: Emulating DLL

2019-03-20 Thread Ethan via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 19:50:15 UTC, Craig wrote: For example, with windows I could simply compile to a dll then extract the code, or just use LoadLibrary and it effectively does all the work(steps 1 & 2 & 3). LoadLibrary performs steps 1 and part of step 2. The DllMain function of a li

Re: Emulating DLL

2019-03-20 Thread Craig via Digitalmars-d-learn
On Wednesday, 20 March 2019 at 14:27:54 UTC, Ethan wrote: On Tuesday, 19 March 2019 at 19:50:15 UTC, Craig wrote: For example, with windows I could simply compile to a dll then extract the code, or just use LoadLibrary and it effectively does all the work(steps 1 & 2 & 3). LoadLibrary perform

Re: Compile-time associative array

2019-03-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/20/19 4:11 AM, boolangery wrote: On Tuesday, 19 March 2019 at 23:41:58 UTC, Steven Schveighoffer wrote: On 3/19/19 7:22 PM, Bastiaan Veelo wrote: Beware that a CT AA stores its elements in a different order than a RT AA, which you would notice in a foreach, for example. Yes, this is the

Re: Emulating DLL

2019-03-20 Thread Ethan Watson via Digitalmars-d-learn
On Wednesday, 20 March 2019 at 19:44:52 UTC, Craig wrote: Do you agree that, at least in some cases, this is entirely feasible and easy? I literally answered in the affirmative in my first post. Note that all that Binderoo does is put function pointers in places that looks like real code, and

Re: Emulating DLL

2019-03-20 Thread SrMordred via Digitalmars-d-learn
On Tuesday, 19 March 2019 at 19:50:15 UTC, Craig wrote: Take a look at my lib, its a simple hot-reload external dll lib: https://github.com/SrMordred/reloaded I did´nt use it extensively, but its simple enough to be tweaked at your own need :)