Skip to content

Instantly share code, notes, and snippets.

@sasq64
Last active November 9, 2018 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasq64/bceb0eadd39d8b587dc1e470a0928a58 to your computer and use it in GitHub Desktop.
Save sasq64/bceb0eadd39d8b587dc1e470a0928a58 to your computer and use it in GitHub Desktop.
JNIEXPORT jlong JNICALL Java_com__getComponent(JNIEnv* env, jclass, jstring name)
{
std::shared_ptr<Component> component = sm->getComponent(JString{name, env});
if (!component)
return 0;
return (jlong)(new std::shared_ptr<Component>(component));
}
JNIEXPORT void JNICALL Java_com_releaseComponent(JNIEnv*, jclass, jlong component)
{
if(component != 0) {
std::shared_ptr<Component>* cr = (std::shared_ptr<Component>*)component;
delete cr;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment