DeepMedia logo
Open Source

Search...

Other versions of this page

Improve this page on GitHub

Search

Callables

We refer to functions and properties as callables. When appropriately annotated, callables can be invoked from either side of the JNI interface (frontend or backend), execute your code on the other side and return some value.

Functions

For a function to be available on the JVM side, it must be annotated with the @Knee annotation. We support top-level functions and functions nested in @KneeClass declarations, as you can learn in classes. Upward functions (called from K/N, implemented on the JVM) are also available through interfaces.

kotlin logokotlin
// Kotlin/Native @Knee fun topLevelFunction(): Int { return 42 } // Kotlin/JVM check(topLevelFunction() == 42)

Properties

For a property to be available on the JVM side, it must be annotated with the @Knee annotation. We support top-level properties and properties nested in @KneeClass declarations, as you can learn in classes. Upward properties (called from K/N, implemented on the JVM) are also available through interfaces.

Both var and val properties are supported.

kotlin logokotlin
// Kotlin/Native @Knee val immutableProp: Int = 42 @Knee var mutableProp: Int = 0 // Kotlin/JVM mutableProp = immutableProp check(mutableProp == immutableProp)

More

Subscribe to the DeepMedia Newsletter

The latest news about DeepMedia products, open source projects and software development at our company.

By clicking “Subscribe”, you agree that DeepMedia may use your email address to send you newsletters, including commercial communications, and to process your personal data for this purpose. You agree that DeepMedia may process said data using third-party services for this purpose in accordance with the DeepMedia Privacy Policy. You can revoke this consent at any time using the unsubscribe link included in each email or by writing at contact@deepmedia.io.