On Saturday, 1 February 2020 at 14:52:21 UTC, kinke wrote:
Trivial cases like yours should actually work wrt. using C++
ctor implementations from D IIRC.
Ah, you need at least one virtual function in the C++ class
(because D always reserves a vptr, the pointer to the class
vtable).
On Saturday, 1 February 2020 at 08:15:20 UTC, Luhrel wrote:
But somehow I got a segfault on dcpp.getNumber(true).
That's because you declare it as virtual in D (default for
classes, use `final`), but non-virtual in C++. You also forgot to
add the class field to the D declaration (yes, D needs
On Saturday, 1 February 2020 at 10:21:54 UTC, norm wrote:
On Saturday, 1 February 2020 at 08:38:22 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, F
On Saturday, 1 February 2020 at 08:38:22 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat
Kurtulmuş wrote:
You cannot.
https://dlang.org/sp
On Saturday, 1 February 2020 at 08:32:51 UTC, Ferhat Kurtulmuş
wrote:
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat Kurtulmuş
wrote:
You cannot.
https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d
You must use
On Saturday, 1 February 2020 at 08:27:07 UTC, Luhrel wrote:
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat Kurtulmuş
wrote:
You cannot.
https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d
You must use a factory method like createInstance.
Oh I see, so there's definitiv
On Saturday, 1 February 2020 at 08:21:29 UTC, Ferhat Kurtulmuş
wrote:
You cannot.
https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d
You must use a factory method like createInstance.
Oh I see, so there's definitively no way to call a c++ ctor
without modifying the c++ code
On Saturday, 1 February 2020 at 08:15:20 UTC, Luhrel wrote:
Hello there,
I would like to know how can I call a C++ ctor.
[...]
You cannot.
https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d
You must use a factory method like createInstance.
Hello there,
I would like to know how can I call a C++ ctor.
Actually, I have this:
C++:
CppClass.cpp
#include "CppClass.h"
AmazingCppClass::AmazingCppClass()
{
number = 124;
}
int AmazingCppClass::getNumber(bool show)
{
if (show)
printf("Numb