Implement Kotlin wrapper for C code
Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
parent
d8d2b3e612
commit
b559d00459
2 changed files with 20 additions and 9 deletions
|
@ -1,11 +1,12 @@
|
|||
package com.wbrawner.cverter;
|
||||
|
||||
public class ConversionHelper {
|
||||
static {
|
||||
System.loadLibrary("c-verter");
|
||||
}
|
||||
|
||||
public static native double celsiusToFahrenheit(double celsius);
|
||||
|
||||
public static native double fahrenheitToCelsius(double celsius);
|
||||
}
|
||||
// Uncomment to use (but also remember to comment out the Kotlin version
|
||||
//public class ConversionHelper {
|
||||
// static {
|
||||
// System.loadLibrary("c-verter");
|
||||
// }
|
||||
//
|
||||
// public static native double celsiusToFahrenheit(double celsius);
|
||||
//
|
||||
// public static native double fahrenheitToCelsius(double celsius);
|
||||
//}
|
||||
|
|
10
app/src/main/kotlin/com/wbrawner/cverter/ConversionHelper.kt
Normal file
10
app/src/main/kotlin/com/wbrawner/cverter/ConversionHelper.kt
Normal file
|
@ -0,0 +1,10 @@
|
|||
package com.wbrawner.cverter
|
||||
|
||||
object ConversionHelper {
|
||||
external fun celsiusToFahrenheit(celsius: Double): Double
|
||||
external fun fahrenheitToCelsius(fahrenheit: Double): Double
|
||||
|
||||
init {
|
||||
System.loadLibrary("c-verter")
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue