Re: Interfacing C++ to D

2017-04-03 Thread ANtlord via Digitalmars-d-learn
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 rando

Re: Interfacing C++ to D

2017-04-02 Thread FreeSlave via Digitalmars-d-learn
On Sunday, 2 April 2017 at 16:03:51 UTC, FreeSlave wrote: On Sunday, 2 April 2017 at 16:02:06 UTC, FreeSlave wrote: On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote: [...] Now I see. 'Using C++ Classes From D' crashes for me too. It also returns the wrong value from 'field' method. Sho

Re: Interfacing C++ to D

2017-04-02 Thread FreeSlave via Digitalmars-d-learn
On Sunday, 2 April 2017 at 16:02:06 UTC, FreeSlave wrote: On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote: 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

Re: Interfacing C++ to D

2017-04-02 Thread FreeSlave via Digitalmars-d-learn
On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote: 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

Re: Interfacing C++ to D

2017-04-02 Thread ANtlord via Digitalmars-d-learn
On Sunday, 2 April 2017 at 09:58:19 UTC, ANtlord wrote: 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

Re: Interfacing C++ to D

2017-04-02 Thread ANtlord via Digitalmars-d-learn
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

Re: Interfacing C++ to D

2017-04-01 Thread FreeSlave via Digitalmars-d-learn
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 "Progr

Interfacing C++ to D

2017-04-01 Thread ANtlord via Digitalmars-d-learn
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.

Re: Interfacing C++ to D --> or better: C++ --> C ---> D (DLL)

2014-03-30 Thread evilrat
On Sunday, 30 March 2014 at 11:16:16 UTC, BeschBesch wrote: have you looked at exported symbols in dll? it may be C++ from what you said(lib not designed for C++?), so you can try extern(C++) on D side instead extern(C). or add manually #ifdef __cplusplus and extern "C" on lib side(if its not t

Re: Interfacing C++ to D --> or better: C++ --> C ---> D (DLL)

2014-03-30 Thread BeschBesch
have you looked at exported symbols in dll? it may be C++ from what you said(lib not designed for C++?), so you can try extern(C++) on D side instead extern(C). or add manually #ifdef __cplusplus and extern "C" on lib side(if its not that big of course). First of all: I started with a C++-dll

Re: Interfacing C++ to D --> or better: C++ --> C ---> D (DLL)

2014-03-30 Thread evilrat
On Saturday, 29 March 2014 at 15:03:18 UTC, BeschBesch wrote: I want to use a set of functions that rely on a library which is not available for D (Harfbuzz). So I just wrote myself a set a functions that will do anything I need (Init, Free, Fonts, Text, etc). The DLL is working fine and dyna

Interfacing C++ to D --> or better: C++ --> C ---> D (DLL)

2014-03-29 Thread BeschBesch
I want to use a set of functions that rely on a library which is not available for D (Harfbuzz). So I just wrote myself a set a functions that will do anything I need (Init, Free, Fonts, Text, etc). The DLL is working fine and dynamically linking should work (it does in C++ --> LoadLibrary).

Re: Interfacing C++ to D --> or better: C++ --> C ---> D (DLL)

2014-03-29 Thread BeschBesch
extern (C) /// needed so the compiler can link the functions { void Test(); } The function of course is called "Test1" not Test.