<div class="gmail_quote">On 21 February 2012 14:33, Iain Buclaw <span dir="ltr"><<a href="mailto:ibuclaw@ubuntu.com">ibuclaw@ubuntu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 21 February 2012 11:03, Manu <<a href="mailto:turkeyman@gmail.com">turkeyman@gmail.com</a>> wrote:<br>
> So I was thinking about this extern(language) thing, the obvious ones are<br>
> supported, but it would be really nice to be able to implement custom<br>
> conventions for other languages/scripting languages.<br>
><br>
> For instance, I'm thinking about Android, I have JNI binding code<br>
> everywhere, it's really ugly.<br>
> I'd love to be able to declare:<br>
>   extern(Java) int someJavaFunc(int x, float y)<br>
><br>
> And then use my function like any regular function, with the 'extern(Java)'<br>
> bit handling the JNI business behind the scenes.<br>
> I also regularly interact with javascript, lua, C#/mono, and these could all<br>
> be implemented the same way.<br>
><br>
> I'm imaging some mechanism to declare a calling convention (which would be<br>
> resolved within the extern(...) statement), and define it with a template,<br>
> something like:<br>
><br>
<br>
</div>Or you could just define extern(Java).<br>
<br>
SDC made a start at this, gdc could implement this using the same as<br>
g++'s extern "Java" interface to gcj (we would only be JNI compatible<br>
with gcj though).<br></blockquote><div><br></div><div>Java was just my example, but it'd be nice to have this option for all external languages I regularly bind to.</div><div>Also, I don't see why hard coded language support for extern(Java) is actually necessary if it were implemented in a flexible way instead.</div>
</div>