December 23, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | On Monday, 22 December 2014 at 23:14:44 UTC, Elie Morisse wrote: > • Structs > https://github.com/Syniurge/Calypso/blob/master/tests/calypso/showcase.d > testClass cls = new testInherit; This should be written testClass* cls = new testInherit; In C++ struct and class differ only in symbol mangling. They are both value types, support inheritance, copy constructors etc. By looking at the declaration you can't decide if a class should be used as value type or reference type, so better treat it as value type like in C++. |
December 23, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | > I have the pleasure to announce to you all the existence of a modified LDC able to interface directly to C++ libraries, wiping out the need to write bindings:
This is nothing short of amazing. I do not know much about streams, up and down. But getting the fantastic toy language that is D to seamlessly integrate C++ puts the whole thing to a new level. There is nothing that can compare.
|
December 23, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Tuesday, 23 December 2014 at 15:20:18 UTC, Kagamin wrote:
> On Monday, 22 December 2014 at 23:14:44 UTC, Elie Morisse wrote:
>> • Structs
>> https://github.com/Syniurge/Calypso/blob/master/tests/calypso/showcase.d
>
>> testClass cls = new testInherit;
>
> This should be written
>
> testClass* cls = new testInherit;
>
> In C++ struct and class differ only in symbol mangling. They are both value types, support inheritance, copy constructors etc. By looking at the declaration you can't decide if a class should be used as value type or reference type, so better treat it as value type like in C++.
At the moment Calypso maps C++ POD records to D structs, and non-POD ones to D classes. But then it's true that this creates a conundrum because I can't translate class value types to D types, so currently functions that expect class value arguments are ignored.
Making C++ classes value types would have lots of implications, so the way I see it (for now, not sure if that's the best solution) I'll probably stick to D class semantics but I'll have to create C++-specific class value types to map C++ fields or functions that take class value arguments.
|
December 23, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | On Tuesday, 23 December 2014 at 15:20:18 UTC, Kagamin wrote:
> On Monday, 22 December 2014 at 23:14:44 UTC, Elie Morisse wrote:
>> • Structs
>> https://github.com/Syniurge/Calypso/blob/master/tests/calypso/showcase.d
>
>> testClass cls = new testInherit;
>
> This should be written
>
> testClass* cls = new testInherit;
>
> In C++ struct and class differ only in symbol mangling. They are both value types, support inheritance, copy constructors etc. By looking at the declaration you can't decide if a class should be used as value type or reference type, so better treat it as value type like in C++.
Ah and you're right that this might confuse the user since he has to know whether the class/struct is POD or not to know whether to use values or references. Hmm.. also simply adding a virtual function to a C++ class would break the D code which previously considered that class POD :)
So maybe you're right, it might be a better idea to make C++ classes values.
|
December 24, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | Or it can switch depending on preprocessor definitions: --- class WXDLLIMPEXP_BASE wxString #ifdef wxNEEDS_WXSTRING_PRINTF_MIXIN : public wxStringPrintfMixin #endif { --- |
December 27, 2014 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to CraigDillabaugh Attachments:
| On 23 Dec 2014 13:30, "CraigDillabaugh via Digitalmars-d-announce" < digitalmars-d-announce@puremagic.com> wrote: > > On Tuesday, 23 December 2014 at 11:53:38 UTC, Dicebot wrote: >> >> On Tuesday, 23 December 2014 at 10:52:58 UTC, Joseph Rushton Wakeling wrote: >>> >>> clip >> >> >> Consider both things like embedded/MIPS and Windows64 - LLVM tooling is not as strong on those right now, GCC does not provide such easy way to reuse C++ frontend and with DMD/MSVC it is simply beyond feasibility. >> >> clip > > > Regarding GCC C++ frontend, will this be of help (also recently posted on this list): > > http://forum.dlang.org/thread/weodkqwxrqetvolhbghb@forum.dlang.org > I would say no. The interface exposed by the jit frontend only supports a small subset of C-like code at this point in time. And doesn't allow you to access other frontends. Iain. |
January 21, 2015 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | Could you explain how to build it's on Windows. I read readme, but do not fully understand what I should to to to get it's work? |
January 21, 2015 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | On 12/22/2014 3:14 PM, Elie Morisse wrote:
> Hi everyone,
>
> I have the pleasure to announce to you all the existence of a modified LDC able
> to interface directly to C++ libraries, wiping out the need to write bindings:
>
> https://github.com/Syniurge/Calypso
I think this is an exciting development!
Considering the new D support for C++ namespaces, template mangling, etc., I think it would make Calypso's job easier. The big challenge is to get an interface to C++ STL, so one could do:
import core.stdcpp.stl.vector;
for example.
I'd also like to encourage you to submit a Dconf 2015 presentation proposal on this.
|
January 21, 2015 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Wednesday, 21 January 2015 at 10:37:18 UTC, Suliman wrote: > Could you explain how to build it's on Windows. I read readme, but do not fully understand what I should to to to get it's work? You should follow the guides for LDC only you need to build Clang 3.5 as well beforehand and add the -DLLVM_SOURCE_PATH="/path/to/llvm/source/tree" argument to the cmake command while building Calypso. Using Visual Studio: http://wiki.dlang.org/Building_and_hacking_LDC_on_Windows_using_MSVC Using MinGW : http://wiki.dlang.org/Building_LDC_on_MinGW_x86 Currently making D classes derive from C++ classes with a virtual table only works with MinGW because only the Itanium ABI is supported. I'm going to add the Microsoft ABI ASAP (it's just a few lines of code) but it'll be untested. On Wednesday, 21 January 2015 at 21:27:27 UTC, Walter Bright wrote: > I think this is an exciting development! > > Considering the new D support for C++ namespaces, template mangling, etc., I think it would make Calypso's job easier. The big challenge is to get an interface to C++ STL, so one could do: > > import core.stdcpp.stl.vector; > > for example. > > I'd also like to encourage you to submit a Dconf 2015 presentation proposal on this. Thanks, Walter! A small update since the announcement: instantiation of C++ class templates is now working, with the right partial specialization selected if any. I'm still working as fast as I can to get Ogre3D working. Ogre3D makes wide usage of the standard C++ library so getting it running would be a milestone and at that point most C++ libraries will be usable or in close reach as well. And it'd also make a sweet demo :) |
January 22, 2015 Re: Calypso: Direct and full interfacing to C++ | ||||
---|---|---|---|---|
| ||||
Posted in reply to Elie Morisse | On 1/21/2015 3:21 PM, Elie Morisse wrote:
> I'm still working as fast as I can to get Ogre3D working. Ogre3D makes wide
> usage of the standard C++ library so getting it running would be a milestone and
> at that point most C++ libraries will be usable or in close reach as well. And
> it'd also make a sweet demo :)
Just making STL work would be an achievement!
Is the output of Calypso a file that can be imported?
|
Copyright © 1999-2021 by the D Language Foundation