Strange JNI Problem [message #258051] |
Fri, 02 July 2004 18:51  |
Eclipse User |
|
|
|
Originally posted by: barlock.usDOT.ibmDOT.com
I refactored some code, changing Java package names. Some of this code is
JNI. I recompiled all the Java and native code and am now getting an
unsatisfied link error on the first call to the native code. In debugging
this, I notice that the "old" DLL has this in it:
_Java_com_ibm_tivoli_monitoring_workbench_util_JNIUtils_gete nv @12
and the "new" DLL has this:
Java_com_ibm_tivoli_rmb_model_workbench_util_JNIUtils_getenv
In the debugger, I get in to Classloader.findNative and see that the second
parameter, name is:
_Java_com_ibm_tivoli_rmb_model_workbench_util_JNIUtils_geten v @12
I'm not sure whether this is the source of the problem or a red
herring...and I don't know why the "old" DLL has this "@12" and the
underscore before "Java" but the new one does not. Does this mean anything
to anyone?
Chris
|
|
|
|
|
|
|
Re: Strange JNI Problem [message #258277 is a reply to message #258264] |
Sun, 04 July 2004 21:29  |
Eclipse User |
|
|
|
Originally posted by: ljoeckel.t-online.de
Chris Barlock wrote:
> "Lothar Joeckel" <ljoeckel@t-online.de> wrote in message
> news:cc8gm3$evj$1@eclipse.org...
>
>>Chris Barlock wrote:
>>
>>>>Absolutely. This type of function name mangling will cause
>>>>UnsatisfiedLineErrors. However, I am puzzled by your description.
>>>>Typically, the function *with* the @xx decoration causes this type of
>>>
>>>error.
>>>
>>>
>>>>What C/C++ compiler are you using?
>>>
>>>
>>>Microsoft Visual C 6.0 with SP5. Why does this name mangling occur and
>
> how
>
>>>to I correct this problem? The old and new versions of the DLL were
>
> built
>
>>>with the same compiler.
>>>
>>>Chris
>>>
>>>
>>
>>Have you changed the type of compile, i.e. from C to C++ or vica verse?
>>Typically the name mangling will be introduced by the C++ compiler.
>>C++ will automatically switch to C++ if the sourcefile has a postfix of
>>'.cpp'. I had the same problem before and after moving my code from a
>>'.c' file to a '.cpp' file and recompiling everything was ok.
>>Hope this helps.
>
>
> No, the source is a set of .cpp files and I haven't changed any of the
> native code -- only the Java code. However one difference: in the version
> that works, the Java code was compiled with JDK 1.3.0. My new version was
> built with JDK 1.4.1. Could that be significant?
>
> Chris
>
>
I'm not sure if you have to regenerate the C Header and Stub files
with 'javah'. Eventually something has changed between these
different jdk-versions.
Lothar
|
|
|
Powered by
FUDForum. Page generated in 0.02953 seconds