Search code examples
androidc++iosdjinni

Djinni: can I define the interfaces as implementable in all the environments?


Consider the documentation of Djinni.

It says that:

# This interface will be implemented in C++ and can be called from any language.
my_cpp_interface = interface +c {
    # ...
}

Also, it says that:

# This interface will be implemented in Java and ObjC and can be called from C++.
my_client_interface = interface +j +o {
    # ...
}

Anyway, I'm in the situation in which I have an object that can be defined either client side or C++ side.
Because of that, I would like to use a syntax like the following one:

my_interface = interface +j +o +c {
    # ...
}

Is it a valid syntax, something that djinni supports (it runs without errors, but I don't know if the code generated is valid as well) or something that I should reconsider?


Solution

  • Yes, that works just fine, and will generate the necessary proxies and marshaling code for that interface to be implemented in any language.