On Fri, Feb 04, 2000 at 12:23:00AM +0000, Ekkehard Kraemer wrote:
> Hallo Lee,
> 
> LX>figure out why.  I have a feeling that saving JNIEnv and jobject in so1 
> LX>to global vars may have problem but not sure.  Thank you and forgive me 
> LX>for 
> 
> I am no expert on .so's, but "global variables" in conjunction with "dynamic
> binding" should ring an alarm bell immediately in any case. ;-) Especially in
> YOUR case, where you're loading the same library (so1) twice, once from the
> Java side, and once from so2. I would be surprised if both would share the
> same global variables (but as I said, I'm no .so expert).

I share this concern. Although the two loads didn't load the library
twice, I'm not convinced you don't have two separate instances of the
library's global data areas. You might try dumping the address of one
of those globals - once when you save into it, later when you use it -
to see if they agree.

I also wonder whether the data you're saving, the JNIEnv ptr and
jobject, are valid outside the call in which you obtained them. The JNI
spec must have something to say about that.

Nathan

> 
> Try to remove any global variables. This will force you to pass them around
> more often (especially, into so2 and out of it again), but it may work better
> afterwards. If you don't want to include the jni.h in so2, you could pass them
> as void* (with explicit casts in so1) and/or create wrapper structs/classes
> for them (so that you only need to pass one pointer instead of two).
> 
> MbG, Ekkehard
> 
> 
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

-- 
[EMAIL PROTECTED]  Public Access User -- Not affiliated with Teleport
Public Access UNIX and Internet at (503) 220-1016 (2400-28800, N81)


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to