I can give you this suggestion, as far as I know from my experience in programming in C and C ++, Once, when I had the same problem, I solved it by changing the structure of the dll data in the ".C" file, changing the function name , which implemented the built-in JNI function. For example, if you want to add your program to the package "com.mypackage", you change the prototype of the JNI that implements the ".C" function / file method:
JNIEXPORT jint JNICALL Java_com_mypackage_Calculations_Calculate(JNIEnv *env, jobject obj, jint contextId) {
Since I am new to delphi, I cannot guarantee you, but I will say it at last (I learned a few things after I entered Delphi and JNI): Ask these people (if you are not the one) who provided Delphi with their own code implementation, to change function names to something like this:
function Java_com_mypackage_Calculations_Calculate(PEnv: PJNIEnv; Obj: JObject; contextId: JInt):JInt; {$IFDEF WIN32} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF} var //Any variables you might be interested in begin //Some code goes here end; function Java_com_mypackage_Calculations_GetProgress(PEnv: PJNIEnv; Obj: JObject; contextId: JInt):JDouble; {$IFDEF WIN32} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF} var //Any variables you might be interested in begin //Some code goes here end;
But, the final tip: although you (if you are a delphi programmer) or they will change the prototypes of these functions and recompile the dll file, once the dll file is compiled, you will not be able to change the package name of your "Java" file again and again. Since this again will require you or their changing function prototypes in delphi with the changed prefixes (e.g. JAVA_yourpackage_with_underscores_for_inner_packages_JavaFileName_MethodName)
I think this solves the problem. Thanks and greetings, Harshal
Harshal Malshe Mar 14 '10 at 10:02 2010-03-14 10:02
source share