Skip to content
This repository has been archived by the owner on Aug 5, 2021. It is now read-only.

added static build and ability to get an existing jvm pointer #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

added static build and ability to get an existing jvm pointer #152

wants to merge 1 commit into from

Conversation

udnaan
Copy link

@udnaan udnaan commented Oct 20, 2018

This makes it easy to embed jpy in an existing java/jni project.

Chiefly, the two changes are the building of a static library and JPy_get_jvm function which would use the JNI call to retrieve the existing JVM pointer.

JNI_GetCreatedJavaVMs(NULL, 0, &nVMs); // 1. just get the required array length
jvms = (JavaVM**)malloc(sizeof(JavaVM*) * nVMs);
JNI_GetCreatedJavaVMs(jvms, nVMs, &nVMs); // 2. get the data
printf("jvm status: %p:%u\nstarting python\n", *jvms, nVMs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only print, if global diagnosis flag is set.

Copy link
Member

@forman forman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@udnaan Thanks! Has this been tested on Mac, Linux, and Windows?

@ShaheedHaque
Copy link

@forman: Also, would having this merged open the door to being able to delete and reload the JVM?

@udnaan: Do you propose to make the change requested by @forman?

@udnaan
Copy link
Author

udnaan commented Feb 21, 2019

I'm okay with it as it seems an isolated enough change. I just can't guarantee that it works as I haven't tested it nor will have time for a few weeks to do so.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants