Click here to Skip to main content
15,909,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Which thread has created this window? Pin
Daniel Kanev25-Sep-08 23:09
Daniel Kanev25-Sep-08 23:09 
GeneralRe: Which thread has created this window? Pin
Joseph Marzbani26-Sep-08 8:07
Joseph Marzbani26-Sep-08 8:07 
QuestionStatic DLL Pin
msr_codeproject25-Sep-08 19:24
msr_codeproject25-Sep-08 19:24 
AnswerRe: Static DLL Pin
ThatsAlok25-Sep-08 19:50
ThatsAlok25-Sep-08 19:50 
AnswerRe: Static DLL Pin
Cedric Moonen25-Sep-08 20:00
Cedric Moonen25-Sep-08 20:00 
Questionavoid loading an already loaded shared library Pin
Yashusid25-Sep-08 18:54
Yashusid25-Sep-08 18:54 
AnswerRe: avoid loading an already loaded shared library Pin
Abhishek Srivastava25-Sep-08 19:45
Abhishek Srivastava25-Sep-08 19:45 
GeneralRe: avoid loading an already loaded shared library Pin
Yashusid25-Sep-08 20:46
Yashusid25-Sep-08 20:46 
Please find my problem in datail...

The problem statement:

--------------------------------------------------------------------------------
Problem with loading a dependant shared object while loading the parent shared object.

Description:

--------------------------------------------------------------------------------
My project has a java module. At runtime this java module loads a JNI shared object(libJNIApi.so).This JNI shared object is dependant on a CPP shared object (libV5Capi.so). Both objects reside in the same directory under installation directory. But the installation directory is not pre defined and can be anywhere on the system.

When libJNIApi.so is loaded through java call System.load("InstallPath/lib/libJNIApi.so"), it also tries to load the libV5Capi.so.
This works fine when the java is invoked from the directory where the libraries are present. But when java is run from a different loaction, the load fails.

The error during this load is

java.lang.UnsatisfiedLinkError: /home/chikkall/test//lib/libJNIApi.so (JVMPORT003E Dependent module libV5Capi.so could not be loaded)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:952)
at java.lang.System.load(System.java:440)
at com.ov.lic.sm.Init.init(Init.java:154)
at com.ov.lic.sm.ConfigManager.init(ConfigManager.java:194)
at com.ov.lic.sm.ConfigManager.initialize(ConfigManager.java:245)
at com.ov.lic.sm.ConfigManager.initialize(ConfigManager.java:259)
at com.ov.lic.sm.ConfigManager.initSecurityModule(ConfigManager.java:170)
at com.ov.lic.sm.ConfigManager.InitializePath(ConfigManager.java:87)
at com.ov.lic.sm.SecurityModule.InitializePath(SecurityModule.java:59)
at JDemoUtility.initPath(JDemoUtility.java:83)
at JDemoUtility.main(JDemoUtility.java:938)

libJNIApi.so is searching for the libV5Capi.so in the current working directory and fails to find it.


Options we considered:



--------------------------------------------------------------------------------
1. Load the dependent shared object(libV5Capi.so) explicitly in java module before loading the parent shared object(libJNIApi.so).
2. Use $ORIGIN in the runtime path of libJNIApi.so, which gets resolved to the absolute path of libNIApi.so at runtime.

Both options work for all unix flavors. But on AIX, For option 1: The parent library still tries to load the dependent library, even if it is loaded.
For option 2: $ORIGIN option is not available(couldn't find in the linker n loader manuals)

Build details:

--------------------------------------------------------------------------------

The libJNIApi.so is built in the make file as

SHRD=/usr/XLC/usr/vacpp/bin/makeC++SharedLib_r
SHRD_OBJ= -p -8192 -bM:SRE -bnoquiet -bnoentry -lc

libJNIApi.so: libV5Capi.so JNIApi.o
$(SHRD) -G $(SHRD_OBJ) -L. -lV5Capi -o $@ $?

Dump of libJNIApi.so

$ dump -Hv libNIApi.so

libJNIApi.so:

***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x00000050 0x000000b4 0x0000005c

#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000003 0x00001010 0x00000cd4 0x0000106c


***Import File Strings***
INDEX PATH BASE MEMBER
0 .:/usr/XLC/usr/vacpp/lib:/usr/lib/threads:/usr/lib:/lib
1 libc.a shr.o
2 libV5Capi.so
QuestionCalling function Pin
cpvc++25-Sep-08 18:32
cpvc++25-Sep-08 18:32 
AnswerRe: Calling function Pin
santhoshv8425-Sep-08 19:54
santhoshv8425-Sep-08 19:54 
GeneralRe: Calling function Pin
cpvc++25-Sep-08 20:16
cpvc++25-Sep-08 20:16 
GeneralRe: Calling function Pin
Daniel Kanev25-Sep-08 23:13
Daniel Kanev25-Sep-08 23:13 
QuestionRe: Calling function Pin
David Crow26-Sep-08 2:55
David Crow26-Sep-08 2:55 
Questionimplementing a class as a linked list and checking for a postfix expression Pin
shadoweKnight25-Sep-08 15:47
shadoweKnight25-Sep-08 15:47 
QuestionRe: implementing a class as a linked list and checking for a postfix expression Pin
Joseph Marzbani25-Sep-08 20:06
Joseph Marzbani25-Sep-08 20:06 
AnswerRe: implementing a class as a linked list and checking for a postfix expression Pin
David Crow26-Sep-08 2:57
David Crow26-Sep-08 2:57 
GeneralRe: implementing a class as a linked list and checking for a postfix expression Pin
shadoweKnight30-Sep-08 14:15
shadoweKnight30-Sep-08 14:15 
QuestionProblem about deque::push_back Pin
kcynic25-Sep-08 14:19
kcynic25-Sep-08 14:19 
AnswerRe: Problem about deque::push_back Pin
Chris Losinger25-Sep-08 14:44
professionalChris Losinger25-Sep-08 14:44 
GeneralRe: Problem about deque::push_back Pin
kcynic25-Sep-08 15:22
kcynic25-Sep-08 15:22 
AnswerRe: Problem about deque::push_back Pin
Cedric Moonen25-Sep-08 20:06
Cedric Moonen25-Sep-08 20:06 
Questionwaiting until a window closes (or, check window's state) Pin
Green Fuze25-Sep-08 12:50
Green Fuze25-Sep-08 12:50 
AnswerRe: waiting until a window closes (or, check window's state) Pin
PJ Arends25-Sep-08 20:02
professionalPJ Arends25-Sep-08 20:02 
AnswerRe: waiting until a window closes (or, check window's state) Pin
Joseph Marzbani25-Sep-08 20:22
Joseph Marzbani25-Sep-08 20:22 
GeneralRe: waiting until a window closes (or, check window's state) Pin
Green Fuze26-Sep-08 0:42
Green Fuze26-Sep-08 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.