<div class="gmail_quote">On 21 February 2012 21:03, Paulo Pinto <span dir="ltr"><<a href="mailto:pjmlp@progtools.org">pjmlp@progtools.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I think this fails in the same trap as extern "language" in C++.<br>
<br>
Besides C and C++, I think the only variation I saw so far for the language part has been fortran, and cannot recall anylonger in what<br>
compiler it was.<br>
<br>
In C++'s case, since it is implementation defined, most compiler vendors<br>
did not bother to support more than what the standard specifies (C and C++).<br>
<br>
In you proposal, how to keep the feature portable across D implementations?<br></blockquote><div><br></div><div>Well since the languages I'm using as examples are VM based, the interaction is through a standardised API, which is most likely part of the same module that defines the custom extern type, both would be presented in the same package.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you make it part of D language specification, which languages would be the chosen ones to be made available in any D compiler?<br>
</blockquote><div><br></div><div>I'm not making any language part of the D specification, I'm suggesting a system to integrate custom calling code, which can be introduced in libraries. No intrinsic support in D for any particular language.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How to garantee correct interoperability (ABI) with other languages? After deciding the set of chosen languages, which compilers/runtimes would be the lucky ones?<br>
</blockquote><div><br></div><div>VM based languages have a strictly defined API, this is guaranteed, no problem.</div><div>Extern to hard-linking languages requires the extra bits I detailed in a prior post (name mangler, call receiver), and probably some version() mess to support different compilers just like C/C++ does all over the place. Many C compilers can't link against each others binaries, but with a mature lib, you'd be able to support the calling convention of popular compilers for your language of interest I would think.</div>
<div>t's probably quite do-able, but I'm not proposing to take the system that far initially. Custom calling conventions to integrate with VM's seems more useful, and much simpler to start with.</div></div>