Java in C++, and vice versa (JNI ?)
Hello !
I'm sorry but this post will be quite lengthy :p I am part of a project (symphonic) which intends to bypass the shitty sonic stage so we can manage our musics on our sony audio players. To explain the problem, I'll make a quick historic : - a first app was made in Java with basic features ; - someone else made a library for winamp with more advanced features in c++ (and bound on windows) ; - it was decided to modify this library so it would run on linux, but in the meantime the java program was upgraded to the point it has nearly as much features as this library now. So, the problem now is that there are 2 internal projects which intend to do the same thing. It was decided that the c++ one would become the main project in the future, but the java one won't be stopped so it's like, twice as much work -_- +/- of the java program : can be run on all system directly from the audio player disk +/- of the c++ program : they absolutely want the project to work as an amarok plugin (or other audio players' plugins), so it seems a java program won't do. The idea is, won't it be easier in the long run to chose only one language, and then use JNI or something (don't know anything about it as far as now) ?? And if yes, do you think it would be better to have the core in c++ and some sort of java launcher, or the core in java and a c++ interface to use it ? I am thinking of a java core and a c++ interface for the plugins' purposes, but as I don't know much about JNI I'd like to know what you think about it :) Any suggestions are really welcome ! Thanks ! |
Have you considered just using gcj?
http://linux.die.net/man/1/gcj http://www.gnu.org/software/gcc/java/ Quote:
|
I think your problem will be with linking, not actually the in-code tasks. Remember that C++ libs have compiler-dependent mangled names, so you might be better off giving the library a C API while retaining C++ internally.
ta0kira |
Quote:
Quote:
@TaOkira : so you think the application core should be in c++, and I'll be able to make a java front end which can use it ? (via a C API ?) edit: having searched about it a bit more, I think the best would be to continue the java program (so it can be launched almost anywhere), and use JNI or CNI (on the compiled java code or not.. ?) so it can be called by c or c++ code for the audio players plugins. I need to be sure this is doable though, but it should be the right path.. |
All times are GMT -5. The time now is 06:34 AM. |