Re: Dlangui customize app icon on dock or menu bar

2018-07-25 Thread rikki cattermole via Digitalmars-d-learn

On 26/07/2018 6:13 AM, Jacob Shtokolov wrote:

On Wednesday, 25 July 2018 at 09:42:00 UTC, Ivo wrote:

I'm a macOs user and I need to build a application with a GUI.


Not sure if the author of the DLangUI is visiting this forum so often to 
be able to answer.


If you won't get an answer in the next few days, I would recommend to 
make an issue in the DLangUI repo: https://github.com/buggins/dlangui


Doesn't matter if he does, this isn't an issue for DLangUI. It's a 
fairly generic one related to OSX.


Re: hasUDA with this

2018-07-25 Thread jmh530 via Digitalmars-d-learn

On Friday, 20 July 2018 at 18:24:11 UTC, Timoses wrote:

[snip]

It works in module scope

https://run.dlang.io/is/OQKYag

I don't know why though...


This was reported in 2013. IMO, it should be mentioned in the 
spec if they don't plan on changing it.


https://issues.dlang.org/show_bug.cgi?id=11064


Re: trait to get the body code of a function?

2018-07-25 Thread 12345swordy via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 19:05:08 UTC, Guillaume Lathoud 
wrote:
On Wednesday, 25 July 2018 at 04:46:20 UTC, rikki cattermole 
wrote:

On 25/07/2018 5:32 AM, Guillaume Lathoud wrote:
Thanks for all the answers. I've just had a look at an 
alternative: using dmd as a package. However that's a lot of 
doc to browse... Maybe someone has experience with dmd as a 
package?


Not a solution. Leaks memory, not reusable and in general not 
very friendly to work with.


Thanks.


Please submit a bug report to Bugzilla on this, as I am also 
interest in this.


Alexander


Re: trait to get the body code of a function?

2018-07-25 Thread Guillaume Lathoud via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 04:46:20 UTC, rikki cattermole 
wrote:

On 25/07/2018 5:32 AM, Guillaume Lathoud wrote:
Thanks for all the answers. I've just had a look at an 
alternative: using dmd as a package. However that's a lot of 
doc to browse... Maybe someone has experience with dmd as a 
package?


Not a solution. Leaks memory, not reusable and in general not 
very friendly to work with.


Thanks.


Re: -allinst and linker errors

2018-07-25 Thread Basile B. via Digitalmars-d-learn

On Wednesday, 25 July 2018 at 15:56:50 UTC, Anonymouse wrote:
I'm trying to build my project with -allinst, after reading the 
comments of issue 18026[1]. Manjaro/Arch 64-bit, dmd 2.081.1 
and ldc 1.0.0.


I get a wall of text with linker errors, both with dmd and ldc. 
Demangled excerpt:

[...]
What can I do?

[1]: https://issues.dlang.org/show_bug.cgi?id=18026#c17


Sorry if i've mislead you in the comment but -allinst works for 
the reduced test case. What you get now seems to be another 
problem. Maybe even the true, deep issue that caused the ICE 
previously (hopefully ?)


Re: Dlangui customize app icon on dock or menu bar

2018-07-25 Thread Jacob Shtokolov via Digitalmars-d-learn

On Wednesday, 25 July 2018 at 09:42:00 UTC, Ivo wrote:

I'm a macOs user and I need to build a application with a GUI.


Not sure if the author of the DLangUI is visiting this forum so 
often to be able to answer.


If you won't get an answer in the next few days, I would 
recommend to make an issue in the DLangUI repo: 
https://github.com/buggins/dlangui


-allinst and linker errors

2018-07-25 Thread Anonymouse via Digitalmars-d-learn
I'm trying to build my project with -allinst, after reading the 
comments of issue 18026[1]. Manjaro/Arch 64-bit, dmd 2.081.1 and 
ldc 1.0.0.


I get a wall of text with linker errors, both with dmd and ldc. 
Demangled excerpt:


characterencodings.o: In function `pure nothrow @nogc @safe 
void 
std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, ref char)':
source/kameloso/uda.d:(.text.pure nothrow @nogc @safe void 
std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, ref char)[pure nothrow @nogc @safe void std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, ref char)]+0x14): undefined reference to `pure nothrow @nogc @safe void std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S.put(char)'
characterencodings.o: In function `pure nothrow @nogc @safe 
void 
std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char)':
source/kameloso/uda.d:(.text.pure nothrow @nogc @safe void 
std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char)[pure nothrow @nogc @safe void std.range.primitives.doPut!(std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char).doPut(ref std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S, char)]+0x14): undefined reference to `pure nothrow @nogc @safe void std.format.hasToString!(std.datetime.systime.SysTime, char).__lambda2().S.put(char)'

[...]


Full output: https://pastebin.com/raw/zX5ua1BT

What can I do?

[1]: https://issues.dlang.org/show_bug.cgi?id=18026#c17


Re: extern(C++): Unresolved scalar deleting destructor

2018-07-25 Thread Vladimir Marchevsky via Digitalmars-d-learn
On Wednesday, 25 July 2018 at 12:04:16 UTC, Vladimir Marchevsky 
wrote:

What I've tested:


Even more: if I create another trivial class in cpp (say, Bar) 
and new/delete it in first one ("b = new Bar();" in ctor, "delete 
b;" in dtor of Foo) - D app with bound Foo just crashes silently 
for some reason.


Re: extern(C++): Unresolved scalar deleting destructor

2018-07-25 Thread Vladimir Marchevsky via Digitalmars-d-learn

Back to questions after homework done :) What I've tested:

Made test class in CPP:

---testlib.cpp
class __declspec(dllexport) Foo {
int *a;

public:
Foo(int value) {
a = new int(value);
}

~Foo() {
delete a;
}
};
---

Binding on D side:

---
extern(C++) {
class Foo {
this(int value);
final ~this();//btw, is this a correct way to bind a 
non-virtual member?

  //What about inheritance and so on?..
}
}
---

Binding works perfect, both ctor and dtor work.

Changed dtor to be virtual (and removed final from D side) - 
anyway, compiles and works perfect. I can provide D 
implementation of destructor which replaces original virtual one 
(is it correct? Or can I call original one from D-specified?) - 
making it empty leads to memory leak as expected. So I see no 
problems here.


Back to QObject. Its destructor is "virtual ~QObject();" but 
having "~this();" on D side again leads to "unresolved scalar 
deleting destructor" of QObject. It looks like actual destructor 
binds correct (I would have another error if I make binding 
incorrect with "final ~this()") but for some reason it wants this 
another thing... Why?


Dlangui customize app icon on dock or menu bar

2018-07-25 Thread Ivo via Digitalmars-d-learn

I'm a macOs user and I need to build a application with a GUI.
I started using Dlangui with SDL2. I need to be able to call some 
functions of my program while working with other applications.
So I would like to personalize the app icon on the dock so that 
when right-clicking such icon the context menu lets me trigger 
some functions.
Otherwise the possibility to add the app icon in the menu bar 
(the bar containing wifi and bluetooth settings) and perform such 
actions from there is also fine.


Thanks in advance for any help.


Re: How to avoid inout type constructor with Optional type wrapper undoing string type

2018-07-25 Thread Timoses via Digitalmars-d-learn

On Tuesday, 24 July 2018 at 14:11:51 UTC, Ali Çehreli wrote:

On 07/24/2018 02:47 AM, Timoses wrote:

> Why does this fail while it works when replacing T with U in
struct
> W(T)?? It's so odd. Both T and U seem to resolve to "string".
>
>  struct W(T) {
>  const T value;
>  // Replacing `T value` with `U value` compiles
>  this(U : T)(auto ref const T value) {

That means, "any U that can implicitly be converted to string". 
However, when U does not appear in the function parameter list, 
there is no way for the compiler to deduce U. (I don't think 
there is syntax to specify constructor template parameters 
explicitly.)


And if the parameter is always T, why is the constructor a 
template? Ok, perhaps U is used inside the constructor and the 
programmer needs to specify it... Still, I don't think there is 
such syntax.


Ali


Ah, thanks!