November 28, 2001
"Phil Brooks" <phil_brooks@mentor.com> wrote in message news:3BA21CE1.E49B18B2@mentor.com...
> I would think you should make this explicit in your documentation. The way it looks now, one could assume that you simply can't mix C++ and D at all.  In reality you can and the way you do it is pretty much the same way that you do it for python, ruby, etc. You have to go through some sort of "C" least common denominator.

The D runtime, in its likely incarnation, will be layered on top of the C runtime. This ensures that you can link in C modules. In addition, at least in my implementation, the C++ runtime is also supported. So, while D cannot call C++ functions directly, you can mix the two by writing C wrappers around the C++ functions. This, of course, is necessary since the initial bootstrap garbage collector is written in C++ <g>.

I just finished making the static constructors/destructors work in D in a manner that does not conflict with C or C++, so they should all work together in one program without stomping each other. One nice fallout of D's static constructor/destructor implementation is no more worries about the order dependency - it's taken care of automatically.


November 28, 2001
"Phil Brooks" <phil_brooks@mentor.com> wrote in message news:3BA2585B.291B02ED@mentor.com...
> Now, if D has link time requirements that are at odds with using a C++ linker, it is another story, but Walter seemed to indicate that this was not an issue.


While it's certainly possible to write a D-aware linker that will provide cool optimizations, I've been careful to specify the language so that an ordinary C linker will work. This goes back to the principle of making it easy to implement the language <g>.


November 28, 2001
"Axel Kittenberger" <axel@dtone.org> wrote in message news:9nurbp$icv$1@digitaldaemon.com...
> with this suggestion you should then also have to explitly count up all other languages that also support C linkage which includes also Assembler, I think Pascal supported it also, my language dtone, and even script languages like Python, etc. this could be an nearly infinity list if
tyring
> to be complete.

It should be possible to hook D functions up to Python by specifying C linkage:

    extern (C)
    {
        void my_interface_to_python(int arg)
        {
            ...
        }
    }


1 2
Next ›   Last »