> I think cls is an instance of LoggerAdapter, not a LogMesg.
> But how to get loggerName field in this situation?
The first two arguments received by the native method are always env
and this (for instance methods), or env and "this class" (for static
methods). Remaining arguments correspond to those mentioned explicitly
in the native declaration, in this case an instance of LogMsg.
So of cource cls in this case refers to LoggerAdapter, since the
method is a static method belonging to that class.
To look up methods in LogMsg, you need to start by obtaining a
reference to the LogMsg class. Since you've passed a LogMsg object to
the method, just pass that to GetObjectClass().
If you hadn't passed an instance of LogMsg, you could have used
FindClass().
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Allen - 11 Dec 2006 10:14 GMT
Thank you.
Yes, I can get logMesg fields now.
But there rises another question.
I use map file (i.e. CreateFileMapping & MapViewOfFile) to share data.
Testing as three individual Win32 EXE, it is OK for map file R/W. But
if I access the map file via JNI, it cannot read a single byte! Why?
Gordon Beaton - 11 Dec 2006 10:34 GMT
> I use map file (i.e. CreateFileMapping & MapViewOfFile) to share data.
> Testing as three individual Win32 EXE, it is OK for map file R/W. But
> if I access the map file via JNI, it cannot read a single byte! Why?
Probably you're doing something wrong.
A more specific answer is impossible without knowing exactly what
you're doing in both cases, and exactly what it is that fails.
Off hand this doesn't really sound like a JNI problem.
CreateFileMapping and MapViewOfFile seem to be Windows API's, so
probably someone else will have to answer anyway.
/gordon

Signature
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e