Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Strange JNI Problem
Strange JNI Problem [message #258051] Fri, 02 July 2004 18:51 Go to next message
Eclipse UserFriend
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 #258055 is a reply to message #258051] Fri, 02 July 2004 19:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: niceguyj.wisdomteeth.comcast.net

Chris Barlock wrote:
> 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?

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?

Jim S.
>
> Chris
>
>
Re: Strange JNI Problem [message #258059 is a reply to message #258055] Fri, 02 July 2004 19:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: barlock.usDOT.ibmDOT.com

> 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
Re: Strange JNI Problem [message #258172 is a reply to message #258059] Sun, 04 July 2004 04:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ljoeckel.t-online.de

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.
Re: Strange JNI Problem [message #258264 is a reply to message #258172] Sun, 04 July 2004 19:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: barlock.usDOT.ibmDOT.com

"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
Re: Strange JNI Problem [message #258277 is a reply to message #258264] Sun, 04 July 2004 21:29 Go to previous message
Eclipse UserFriend
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
Previous Topic:Porting to 3.0 & Eclipse's complexity
Next Topic:How to make editor resource content type aware?
Goto Forum:
  


Current Time: Sun May 11 03:34:00 EDT 2025

Powered by FUDForum. Page generated in 0.02953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top