On 21 February 2012 11:03, Manu <[email protected]> wrote: > So I was thinking about this extern(language) thing, the obvious ones are > supported, but it would be really nice to be able to implement custom > conventions for other languages/scripting languages. > > For instance, I'm thinking about Android, I have JNI binding code > everywhere, it's really ugly. > I'd love to be able to declare: > extern(Java) int someJavaFunc(int x, float y) > > And then use my function like any regular function, with the 'extern(Java)' > bit handling the JNI business behind the scenes. > I also regularly interact with javascript, lua, C#/mono, and these could all > be implemented the same way. > > I'm imaging some mechanism to declare a calling convention (which would be > resolved within the extern(...) statement), and define it with a template, > something like: >
Or you could just define extern(Java). SDC made a start at this, gdc could implement this using the same as g++'s extern "Java" interface to gcj (we would only be JNI compatible with gcj though). -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
