This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "calculator_impl.hpp" | |
#include <string> | |
namespace calculator{ | |
std::shared_ptr<Calculator> Calculator::create() { | |
return std::make_shared<CalculatorImpl>(); | |
} | |
CalculatorImpl::CalculatorImpl() {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "calculator_impl.hpp" | |
#include <iostream> | |
using namespace std; | |
using namespace calculator; | |
int main(int argc, char const *argv[]) | |
{ | |
CalculatorImpl calculator = CalculatorImpl(); | |
int sum = calculator.summation(1, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.4.1) | |
file(GLOB calculator_sources | |
../../djinni/support-lib/jni/*.cpp | |
../../generated/jni/*.cpp | |
../../src/cpp/*.cpp | |
) | |
add_library( # Sets the name of the library. | |
calculator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.gdgkl.androidapplication; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
import com.example.yourcompany.Calculator; | |
public class MainActivity extends AppCompatActivity { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calculator = | |
interface +c { | |
# create() is to create an instance of the calculator | |
static create(): calculator; | |
# summation, adding two i32.. aka integers together. And return an integer. | |
summation(number1: i32, number2: i32):i32; | |
# look at me, a subtraction method! :) | |
subtraction(number1: i32, number2: i32):i32; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "calculator_impl.hpp" | |
#include <string> | |
namespace calculator{ | |
std::shared_ptr<Calculator> Calculator::create() { | |
return std::make_shared<CalculatorImpl>(); | |
} | |
CalculatorImpl::CalculatorImpl() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file was generated by the Gradle 'init' task. | |
* | |
* This is a general purpose Gradle build. | |
* Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/ | |
*/ | |
group 'org.netvirta' | |
version '0.0.1-SNAPSHOT' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xcodebuild -project HelloFramework.xcodeproj -target HelloFramework -sdk iphonesimulator11.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CalculatorAndroidImpl::hello(const std::string &text) { | |
__android_log_print(ANDROID_LOG_DEBUG, "Calculator", | |
"Calculator", text); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace djinni { | |
struct ByteBuffer { | |
using CppType = int8_t *; | |
using JniType = jobject; | |
static CppType toCpp(JNIEnv* env, JniType j) { | |
return (int8_t *) env->GetDirectBufferAddress(j); | |
} | |
static JniType fromCpp(JNIEnv *env, CppType c) { |