Compile-time list of imported modules

2024-04-09 Thread Vladimir Marchevsky via Digitalmars-d-learn
Practical example: some framework allows it's user to define types of some messages. It can be done by manual calls like `something.registerMessage!T1()`, `something.registerMessage!T2()`. Other way is to leave it to framework: just annotate `T1`, `T2` with `@Command` UDA and call some core fr

extern(C++): Unresolved scalar deleting destructor

2018-07-24 Thread Vladimir Marchevsky via Digitalmars-d-learn
After reading 2.081 patchnotes about improvements with binding to cpp classes, I'm trying to test it - with simple examples and Qt as cpp library. My naive approach is to bind just a couple of used methods of specific classes (omitting others) and try to use it directly in D just with linking

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

2018-07-24 Thread Vladimir Marchevsky via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 16:30:41 UTC, Stefan Koch wrote: Seems like it's virtual destructor could that be? this qt5 binding: https://github.com/MGWL/QtE5/blob/master/source/qte5.d seems to always define the constructor. No, simple virtual (or final) destructor binds just fine with "~thi

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

2018-07-24 Thread Vladimir Marchevsky via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 19:04:50 UTC, 12345swordy wrote: Have you tried @disable ~this()? Just tried: 1) no changes, still error about unresolved "QObject::`scalar deleting destructor'(unsigned int)". 2) marking destructor as @disable will actually disable it, right? But I want to use to

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

2018-07-24 Thread Vladimir Marchevsky via Digitalmars-d-learn
On Tuesday, 24 July 2018 at 19:30:49 UTC, 12345swordy wrote: I found similar error messages regarding c++: https://stackoverflow.com/questions/42449063/vs-c-dll-scalar-deleteing-destructor Hmm, so looks like it's really because of virtual destructor, like Stefan mentioned before. Implementing

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++) {

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