February 16, 2015
Hello Elie,

Ok, I tried to build on OS X with the LLVM/Clang revisions from above and
the Calypso/LDC code from my github fork, but it is a no go.

Calypso compiles pretty easily, but there are issues with "vector" not being
found, so then I install libc++ so that clang easily picks up the correct
include directories.

Then "unistd.h" isn't found...ok it turns out XCode Command Line Tools needs
to be installed to get some gcc specific files, but the internal Calypso
call to clang needs to be modified.

Change Calypso to call 'xcrun --show-sdk-path`, because this seems to work
from the command line. Needs to be run from a shell...ugh. Etc, etc.

Run into problems with libc++ and libstdc++ colliding. Remove libc++. Ugh.

I finally just compile things by hand and get through to Calypso running
and producing a bunch of object files, but then gcc won't link in  some allocator code from stdc++?? Sheesh, not sure what is going on...I have
tried several different ways to fix this, to no avail.

Anyways, I am tired so I will just have to mess with this some more tomorrow
or the next day. Hopefully I can figure out what is going on as it seems
close to working.

There might be real issues with someone having libc++ and libstdc++
alongside XCode tools like I had.


Thanks,
Kelly

P.S. I try out Calypso from your github repo most days and the
vector/bitset/showcase examples weren't working with todays code -->
"Do not call _d_invariant on C++ class objects". Just to make sure you
are aware of it.
February 17, 2015
Hi Kelly,

It's done, I've merged latest LDC upstream + your build fixes into Calypso.

About Microsoft vtables they work much more differently from the Itanium ones than I thought, it's going to a lot trickier than just a few lines of code so I won't be able to make D classes inheriting from C++ ones work on MSVC until I setup a dev environment on Windows.

It's just those « D-C++ classes » though, the rest has a better chance to work now.
February 17, 2015
On Tuesday, 17 February 2015 at 01:53:22 UTC, Elie Morisse wrote:
> Hi Kelly,
>
> It's done, I've merged latest LDC upstream + your build fixes into Calypso.

Alright, cool. I pulled it here and things build fine on Linux. Showcase and string examples work nicely.

> About Microsoft vtables they work much more differently from the Itanium ones than I thought, it's going to a lot trickier than just a few lines of code so I won't be able to make D classes inheriting from C++ ones work on MSVC until I setup a dev environment on Windows.

Ok, developing on Win is not the nicest right now. I use Qt and it seems like the best option (change to msvc when needed...like to change the Debug/Release build types because the command line and Qt don't seem persistent).

> It's just those « D-C++ classes » though, the rest has a better chance to work now.

Ok, I might try to build again here and see how it goes.

Thanks,
Kelly

P.S. I HATE THIS FORUM EDITOR----please add a preview button, whoever takes care of this!?!? I take notes in a different editor and then paste here and it looks fine, only to end up mangled when actually submitted...ugh!!!!  :)
February 17, 2015
On Tue, Feb 17, 2015 at 02:16:57 +0000, Kelly via Digitalmars-d-announce wrote:
> P.S. I HATE THIS FORUM EDITOR----please add a preview button, whoever takes care of this!?!? I take notes in a different editor and then paste here and it looks fine, only to end up mangled when actually submitted...ugh!!!!  :)

You can subscribe via email.

--Ben
February 17, 2015
On Tuesday, 17 February 2015 at 02:16:58 UTC, Kelly wrote:
> P.S. I HATE THIS FORUM EDITOR----please add a preview button, whoever takes care of this!?!? I take notes in a different editor and then paste here and it looks fine, only to end up mangled when actually submitted...ugh!!!!  :)

You mean wrapping? Don't wrap the text manually, server does on its own.
February 18, 2015
Hello Elie,

I just pushed a small pull request for fromTypeTemplateSpecialization. I forgot to mention in the request that the changes allow bitset.d to be compiled and run again.

With those changes all the examples compile and run again. There are still two errors when compiling vector.d. Clang errors when making the pch file. LDC2 still runs and produces a working binary anyways.

Not sure what you are working on, but I can look at those errors if you like. Do you have an email address I can get in touch with you at? Jump on to #ldc on IRC and pm me if you don't want to post here.

I didn't look at the build errors on OS X again yet...got tired of build errors for  a bit :)

Thanks,
Kelly

February 18, 2015
On Wednesday, 18 February 2015 at 08:52:33 UTC, Kelly wrote:
> Hello Elie,
>
> I just pushed a small pull request for fromTypeTemplateSpecialization. I forgot to mention in the request that the changes allow bitset.d to be compiled and run again.

Thanks for looking into this, I'll check your PR.

> With those changes all the examples compile and run again. There are still two errors when compiling vector.d. Clang errors when making the pch file. LDC2 still runs and produces a working binary anyways.
>
> Not sure what you are working on, but I can look at those errors if you like.

Are these errors occurring when Clang generates the PCH or later in the semantic pass? There might be errors during the instantiation of member functions of class templates because Calypso tries to instantiate everything (whereas Clang instantiates them lazily), but it's no big deal, later they'll be made silent.


BTW I just pushed support for function template instantiation.

So lately thanks to a bit of free time there has been quite a lot of new features implemented: overloaded operators, function templates, and groundwork for class value types (they were added to the AST as a new semi-hackish kind of type, they make mapping any C++ type possible but they can't be used directly from D code yet).

Operators should make std::map usable, so I'm going to resume testing further STL types.
February 24, 2015
On Wednesday, 18 February 2015 at 16:18:10 UTC, Elie Morisse wrote:
> BTW I just pushed support for function template instantiation.
>
> So lately thanks to a bit of free time there has been quite a lot of new features implemented: overloaded operators, function templates, and groundwork for class value types (they were added to the AST as a new semi-hackish kind of type, they make mapping any C++ type possible but they can't be used directly from D code yet).
>
> Operators should make std::map usable, so I'm going to resume testing further STL types.

Just so others know, coding of Calypso continues and more of the STL is working now. Currently these C++ files can be mapped and used from a D program with Calypso:

bitset
deque
foreach
list
map
set
stack
string
vector
vstring  <-- just a vector of strings, but at least using classes in combination is working.


Not all functions in these files work, but a significant portion do in most cases above. Iterators are still not working due to class value support being incomplete, but hopefully it will be working soon. Thanks to Elie for moving forward with this.

Coding continues :)

Thanks,
Kelly
February 24, 2015
On Tuesday, 24 February 2015 at 08:39:39 UTC, Kelly wrote:
> due to class value support being incomplete

What about using that trick: recognize C++ classes and represent them internally as structs with altered mangling - at least it frees you from messing with D classes.
February 24, 2015
On Tuesday, 24 February 2015 at 08:44:25 UTC, Kagamin wrote:
> On Tuesday, 24 February 2015 at 08:39:39 UTC, Kelly wrote:
>> due to class value support being incomplete
>
> What about using that trick: recognize C++ classes and represent them internally as structs with altered mangling - at least it frees you from messing with D classes.

What about inheritance, polymorphism and virtual methods that aren't supported by D structs? I'm worried that it's going be a lot harder to reimplement everything in structs.

Atm to quickly make functions that take or return class values work what's missing is implicit casts between the class value types I added recently (the hacky TypeValueof) and the normal class types, and support in codegen. So it's not too far away I think.