digitalmars.D.learn - Interfacing C++ to D
- ANtlord (7/7) Apr 01 2017 Hello!
- FreeSlave (3/10) Apr 01 2017 This page has many examples. Which exactly do you try to run and
Hello! Can somebody give a relevant example shows how to use C++ classes in D? I've used the exmaple from https://dlang.org/spec/cpp_interface.html but I get a segmentation fault as result of D application. My application shows "Program exited with code -11" Thanks.
Apr 01 2017
On Saturday, 1 April 2017 at 07:37:25 UTC, ANtlord wrote:Hello! Can somebody give a relevant example shows how to use C++ classes in D? I've used the exmaple from https://dlang.org/spec/cpp_interface.html but I get a segmentation fault as result of D application. My application shows "Program exited with code -11" Thanks.This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS?
Apr 01 2017
On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote:This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS?My bad. I've tested example under caption Using C++ Classes From D. I used several combinations of compilers, and no one works for me. OS: ArchLinux D compilers: DMD 2.073.2, LDC 1.1.0 C++ compiler: gcc 6.3.1, clang 3.9 Also I've created reposotory contains test project. Anyone can take a look on that for clearance. https://github.com/ANtlord/cpp_to_d_test
Apr 02 2017
On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote:On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote:I've tested also on Ubuntu 16.04 and DMD v2.073.1 with gcc 5.4.0This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS?My bad. I've tested example under caption Using C++ Classes From D. I used several combinations of compilers, and no one works for me. OS: ArchLinux D compilers: DMD 2.073.2, LDC 1.1.0 C++ compiler: gcc 6.3.1, clang 3.9 Also I've created reposotory contains test project. Anyone can take a look on that for clearance. https://github.com/ANtlord/cpp_to_d_test
Apr 02 2017
On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote:On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote:Now I see. 'Using C++ Classes From D' crashes for me too. It also returns the wrong value from 'field' method. Should be 5, but it returns 0. Probably regression.This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS?My bad. I've tested example under caption Using C++ Classes From D. I used several combinations of compilers, and no one works for me. OS: ArchLinux D compilers: DMD 2.073.2, LDC 1.1.0 C++ compiler: gcc 6.3.1, clang 3.9 Also I've created reposotory contains test project. Anyone can take a look on that for clearance. https://github.com/ANtlord/cpp_to_d_test
Apr 02 2017
On Sunday, 2 April 2017 at 16:02:06 UTC, FreeSlave wrote:On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote:Funny thing: If I replace interface with abstract class, it works as it should.On Saturday, 1 April 2017 at 16:39:28 UTC, FreeSlave wrote:Now I see. 'Using C++ Classes From D' crashes for me too. It also returns the wrong value from 'field' method. Should be 5, but it returns 0. Probably regression.This page has many examples. Which exactly do you try to run and how do you build it? Which compilers, OS?My bad. I've tested example under caption Using C++ Classes From D. I used several combinations of compilers, and no one works for me. OS: ArchLinux D compilers: DMD 2.073.2, LDC 1.1.0 C++ compiler: gcc 6.3.1, clang 3.9 Also I've created reposotory contains test project. Anyone can take a look on that for clearance. https://github.com/ANtlord/cpp_to_d_test
Apr 02 2017
On Sunday, 2 April 2017 at 16:03:51 UTC, FreeSlave wrote:On Sunday, 2 April 2017 at 16:02:06 UTC, FreeSlave wrote:Reported issue: https://issues.dlang.org/show_bug.cgi?id=17293On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote:Funny thing: If I replace interface with abstract class, it works as it should.[...]Now I see. 'Using C++ Classes From D' crashes for me too. It also returns the wrong value from 'field' method. Should be 5, but it returns 0. Probably regression.
Apr 02 2017
On Sunday, 2 April 2017 at 16:03:51 UTC, FreeSlave wrote:Funny thing: If I replace interface with abstract class, it works as it should.Also I noticed that removing inheritance in library and in application makes unexpected results. When I try to output field `field` I get incorrect random value. It looks like that the field is got by wrong address. For clearance I created branch `removed-inheritance`.
Apr 03 2017