Re: [Boost-users] Possible to use with JNI?
At 06:30 13/04/2015, you wrote:
Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help.
Hi, AFAIK it is not easy to do that due to C++ name mangling and the absence of any ABI in C++ itself like C A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types regardds Lorenzo
Ah... I'm really lost here. The reason that I want to use Boost with Java is because I found that: The original VF2lib (ported from C to Java) is somehow slower than Boost. I checked by trying to find subgraph isomorphism between graph A (10 nodes) and graph B (500 nodes). VF2lib took longer than 5 minutes but Boost was just some milliseconds. (If someone can verify that I'll be really grateful). So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost. On Wed, Apr 15, 2015, 9:30 PM Lorenzo Trivelli < trivelli.lorenzo@konvergence.it> wrote:
Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find
At 06:30 13/04/2015, you wrote: the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help.
Hi, AFAIK it is not easy to do that due to C++ name mangling and the absence of any ABI in C++ itself like C
A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types
regardds Lorenzo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
Ah... I'm really lost here. The reason that I want to use Boost with Java is because I found that: The original VF2lib (ported from C to Java) is somehow slower than Boost. I checked by trying to find subgraph isomorphism between graph A (10 nodes) and graph B (500 nodes). VF2lib took longer than 5 minutes but Boost was just some milliseconds. (If someone can verify that I'll be really grateful).
So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
On Wed, Apr 15, 2015, 9:30 PM Lorenzo Trivelli
wrote: At 06:30 13/04/2015, you wrote:
Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help.
Hi, AFAIK it is not easy to do that due to C++ name mangling and the absence of any ABI in C++ itself like C
A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types
The expert opinion is that you should be able to develop a DLL with C interface, and leverage the Boost/C++ behind the C API. You'll need to know the data types translations between the two, but this should be readily documented, or for the most part more or less discoverable.
regardds Lorenzo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 2015-04-15 12:23 PM, Michael Powell wrote:
On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
wrote: Ah... I'm really lost here. The reason that I want to use Boost with Java is because I found that: The original VF2lib (ported from C to Java) is somehow slower than Boost. I checked by trying to find subgraph isomorphism between graph A (10 nodes) and graph B (500 nodes). VF2lib took longer than 5 minutes but Boost was just some milliseconds. (If someone can verify that I'll be really grateful).
So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
On Wed, Apr 15, 2015, 9:30 PM Lorenzo Trivelli
wrote: Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help. Hi, AFAIK it is not easy to do that due to C++ name mangling and
At 06:30 13/04/2015, you wrote: the absence of any ABI in C++ itself like C
A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types The expert opinion is that you should be able to develop a DLL with C interface, and leverage the Boost/C++ behind the C API. You'll need to know the data types translations between the two, but this should be readily documented, or for the most part more or less discoverable.
regardds Lorenzo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If you want to use a Java lib and save some interface pain, it might be worth checking this out: http://stackoverflow.com/questions/51574/good-java-graph-algorithm-library Damien
On Wed, Apr 15, 2015 at 2:32 PM, Damien
On 2015-04-15 12:23 PM, Michael Powell wrote:
On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
wrote: Ah... I'm really lost here. The reason that I want to use Boost with Java is because I found that: The original VF2lib (ported from C to Java) is somehow slower than Boost. I checked by trying to find subgraph isomorphism between graph A (10 nodes) and graph B (500 nodes). VF2lib took longer than 5 minutes but Boost was just some milliseconds. (If someone can verify that I'll be really grateful).
So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
On Wed, Apr 15, 2015, 9:30 PM Lorenzo Trivelli
wrote: At 06:30 13/04/2015, you wrote:
Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help.
Hi, AFAIK it is not easy to do that due to C++ name mangling and the absence of any ABI in C++ itself like C
A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types
The expert opinion is that you should be able to develop a DLL with C interface, and leverage the Boost/C++ behind the C API. You'll need to know the data types translations between the two, but this should be readily documented, or for the most part more or less discoverable.
regardds Lorenzo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
If you want to use a Java lib and save some interface pain, it might be worth checking this out:
http://stackoverflow.com/questions/51574/good-java-graph-algorithm-library
I was stopping just short of fishing for her. "You can given a man a fish, he has a meal..." In Christ.
Damien
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
I'm not sure if this is what you said above, but another possibility would be: * Write your graph data to one or more files. * Write code to cause the Java program to execute a C++ program and wait for it to finish. * Write a C++ program to read those files and use Boost.Graph, or whatever, to process them. * Write the C++ program output to another file. * Read the results file back into the Java program. That might be more straightforward than trying to pass all your graph data back and forth across the language boundary.
Yes Nat, I think I'll end up doing that.
Thanks Michael, I know that there is jGraphT but I haven't got a look into
it. I was just asking around first. I'll definitely give that a try.
Thank you all for the help.
On Thu, Apr 16, 2015, 4:12 AM Nat Goodspeed
On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
wrote: So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
I'm not sure if this is what you said above, but another possibility would be:
* Write your graph data to one or more files. * Write code to cause the Java program to execute a C++ program and wait for it to finish. * Write a C++ program to read those files and use Boost.Graph, or whatever, to process them. * Write the C++ program output to another file. * Read the results file back into the Java program.
That might be more straightforward than trying to pass all your graph data back and forth across the language boundary. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On April 15, 2015 6:41:39 PM EDT, Yolanda Septiana
Yes Nat, I think I'll end up doing that.
Thanks Michael, I know that there is jGraphT but I haven't got a look into it. I was just asking around first. I'll definitely give that a try.
Thank you all for the help.
Glad I could help.
On Thu, Apr 16, 2015, 4:12 AM Nat Goodspeed
wrote: On Wed, Apr 15, 2015 at 10:57 AM, Yolanda Septiana
wrote: So what option do I have to be able to use Boost? I think I should a file based graph generated by Java and process them with Boost.
I'm not sure if this is what you said above, but another possibility would be:
* Write your graph data to one or more files. * Write code to cause the Java program to execute a C++ program and wait for it to finish. * Write a C++ program to read those files and use Boost.Graph, or whatever, to process them. * Write the C++ program output to another file. * Read the results file back into the Java program.
That might be more straightforward than trying to pass all your graph data back and forth across the language boundary. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
2015-04-15 10:29 GMT-04:00 Lorenzo Trivelli : Hi, I really need to use Java with this library. Is it possible to use
JNI on this library or do I need to convert this library to Java? I find At 06:30 13/04/2015, you wrote:
the latter task is going to be really difficult so I hope that I can use
JNI. Thank you for your help. Hi, AFAIK it is not easy to do that due to C++ name mangling and
the absence of any ABI in C++ itself like C A possible but limited workaround should be to create a DLL with a C
interface
which uses the boost objects you need. Next, you can call it through JNI,
but obviously you can pass only basic data types regardds
Lorenzo As Lorenzo indicated you need to create a C++ layer between your java code
and the boost libraries. You won't be able to call the boost functions
directly from your java code. Your C++ jni code can actually read instance
variables from a java object (see for instance the JNI function
GetDoubleField). But you will be spending a lot of time writing C++ code to
create C++ objects from java object, and then to create Java objects from
C++ when you return the results from executing the boost code.
On Wed, Apr 15, 2015 at 10:29 AM, Lorenzo Trivelli
At 06:30 13/04/2015, you wrote:
Hi, I really need to use Java with this library. Is it possible to use JNI on this library or do I need to convert this library to Java? I find the latter task is going to be really difficult so I hope that I can use JNI.
Thank you for your help.
Hi, AFAIK it is not easy to do that due to C++ name mangling and the absence of any ABI in C++ itself like C
A possible but limited workaround should be to create a DLL with a C interface which uses the boost objects you need. Next, you can call it through JNI, but obviously you can pass only basic data types
I would concur with this approach: if you can distill an API that would be useful to your Java environment.
regardds Lorenzo
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (7)
-
Alain Leblanc
-
Damien
-
Lorenzo Trivelli
-
Michael
-
Michael Powell
-
Nat Goodspeed
-
Yolanda Septiana