Re: How can I use Linker flags using DMD?

2023-05-29 Thread Ali Çehreli via Digitalmars-d-learn
On 5/29/23 07:29, Marcone wrote: I want send flags to linker when using dmd.exe compiler. -L does it. Yes, -L-L can happen. :) https://dlang.org/dmd-linux.html Ali

Re: How get struct value by member name string ?

2023-05-29 Thread John Xu via Digitalmars-d-learn
On Monday, 29 May 2023 at 11:21:11 UTC, Adam D Ruppe wrote: On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote: Error: variable `column` cannot be read at compile time you should generally getMember on a variable T t; __traits(getMember, t, "name") like that, that's as if you wrote

Re: How get struct value by member name string ?

2023-05-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, May 30, 2023 at 01:24:46AM +, John Xu via Digitalmars-d-learn wrote: > On Monday, 29 May 2023 at 11:21:11 UTC, Adam D Ruppe wrote: > > On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote: > > > Error: variable `column` cannot be read at compile time > > > > you should generally

Re: How can I use Linker flags using DMD?

2023-05-29 Thread Marcone via Digitalmars-d-learn
On Monday, 29 May 2023 at 22:48:29 UTC, Ali Çehreli wrote: On 5/29/23 07:29, Marcone wrote: I want send flags to linker when using dmd.exe compiler. -L does it. Yes, -L-L can happen. :) https://dlang.org/dmd-linux.html Ali Can you help me static link dll msvcr120.dll in my x64 dlang

How get struct value by member name string ?

2023-05-29 Thread John Xu via Digitalmars-d-learn
I saw ddbc (https://github.com/buggins/ddbc/blob/master/source/ddbc/pods.d) uses static if (__traits(compiles, (typeof(__traits(getMember, T, m) { __traits(getMember, T, m) } But for my experience, above code sometimes/somewhere works, sometimes/somewhere just doesn't:

Re: How get struct value by member name string ?

2023-05-29 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 29 May 2023 at 09:35:11 UTC, John Xu wrote: Error: variable `column` cannot be read at compile time you should generally getMember on a variable T t; __traits(getMember, t, "name") like that, that's as if you wrote t.name

Re: How can I use Linker flags using DMD?

2023-05-29 Thread Ali Çehreli via Digitalmars-d-learn
On 5/29/23 17:39, Marcone wrote: > Can you help me static link dll msvcr120.dll in my x64 dlang program? Sorry, I haven't been programming on Windows for a very long time now. :/ But there are others who program on Windows here. Ali

Re: Code duplication where you wish to have a routine called with either immutable or mutable arguments

2023-05-29 Thread Ali Çehreli via Digitalmars-d-learn
On 5/29/23 19:57, Cecil Ward wrote: > I wish to have one routine > that can be called with either immutable or (possibly) mutable argument > values. 'const' should take both immutable and mutable. Can you show your case with a short example? > Could I make the one routine into a template?

Re: How static link dll msvcr120.dll?

2023-05-29 Thread novice2 via Digitalmars-d-learn
you cannot "static link dll", "d" in "dll" is "dynamic". you can implicity or explicity load dll. https://learn.microsoft.com/en-us/cpp/build/linking-an-executable-to-a-dll?view=msvc-170 may be you mean static link msvcr120.lib? i am not windows guru, but you need msvcr120.lib (there is 2

Re: Code duplication where you wish to have a routine called with either immutable or mutable arguments

2023-05-29 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 02:57:52 UTC, Cecil Ward wrote: I have often come into difficulties where I wish to have one routine that can be called with either immutable or (possibly) mutable argument values. The argument(s) in question are in, readonly, passed by value or passed by const

Code duplication where you wish to have a routine called with either immutable or mutable arguments

2023-05-29 Thread Cecil Ward via Digitalmars-d-learn
I have often come into difficulties where I wish to have one routine that can be called with either immutable or (possibly) mutable argument values. The argument(s) in question are in, readonly, passed by value or passed by const reference. Anyway, no one is trying to write to the items passed