Difference between revisions of "Calypso"

From D Wiki
Jump to: navigation, search
(Missing features)
Line 1: Line 1:
[https://github.com/Syniurge/Calypso Calypso] is an experimental [[LDC]] fork that offers alternative interfacing to C++ based on Clang rather than the official "from scratch" approach. It attempts to widen and facilitate C++ support while minimizing intrusions into the code of the DMD frontend and LDC.
+
[https://github.com/Syniurge/Calypso Calypso] is an experimental [[LDC]] fork that offers alternative interfacing to C++ based on Clang instead of implementing it "from scratch" as is currently being done in the official compiler. It attempts to widen and facilitate C++ support while minimizing intrusions into the code of the DMD frontend and LDC.
  
 
It is designed so that when the day comes splitting Calypso from LDC will be easy and Calypso could then exist as a LDC plugin in the form of a shared library.
 
It is designed so that when the day comes splitting Calypso from LDC will be easy and Calypso could then exist as a LDC plugin in the form of a shared library.

Revision as of 21:23, 7 June 2016

Calypso is an experimental LDC fork that offers alternative interfacing to C++ based on Clang instead of implementing it "from scratch" as is currently being done in the official compiler. It attempts to widen and facilitate C++ support while minimizing intrusions into the code of the DMD frontend and LDC.

It is designed so that when the day comes splitting Calypso from LDC will be easy and Calypso could then exist as a LDC plugin in the form of a shared library.

Advanced features

Some of its features include:

  • C++ class and struct construction and destruction
  • Support of C++ classes making use of multiple inheritance
  • D classes inheriting from C++ classes, and overriding C++ virtual methods by D methods (with the generation of C++ vtables)
  • Template support, instantiation of C++ class and function templates by D code
  • Overloaded operators, conversion operators
  • Constant and empty preprocessor macros (mapped to enums)
  • C++ exception catching (any type, not just std::exception)

Current status

Importing and using C++03 libraries is fully implemented (not C++0x/C++11 yet). However due to sometimes subtle differences between D and C++, to remaining bugs, or because importing a big library can be very testing for the DMD frontend (resulting in forward referencing errors), hitting a bug that makes the semantic pass fail is still a common occurrence for untested libraries. They are most of the time quickly fixable after investigating.

Calypso has been tested primarily on Linux. OS X has been barely tested but some examples have been reported to work, and MSVC support is still incomplete.

Libraries known to work well are:

  • Qt5 (both Widgets and Quick)
  • OpenCV
  • Tesseract
  • Ogre3D

This is by no means a exhaustive list of working libraries, only the ones which have been successfully used in a (commercial) project. Others have been reported to work in basic examples (Boost, GDAL, FastFlow).

Missing features

  • Register the destructor of C++ classes and structs while allocating a C++ class through the GC (as is being done for D structs)
  • Automatically call copy constructors on function arguments
  • Currently Calypso has only been truly tested on Linux

MSVC TODOs

  • vtable generation for the C++ part of "hybrid" D classes deriving from a C++ class
  • exception handling
  • linker support in runtime/link_autogen_cpp.cmake

How to help

More testing is needed. If you don't intend to fix the code of Calypso yourself a good way to help is to open a Github issue, copy the failing code and provide the name and version of the library used, so investigating can begin right away.