|
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
|
|
|
|
|
Hi All
I have a problem to call BOOL type function.I have declear a function in header file and calling in same header file.Then i am geting error
error C3861: 'str': identifier not found
Plz help me
|
|
|
|
|
Hi,
First check did you declared the variable 'str'.
Could you please show the function.
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
yes
public:
bool str();
and
bool CCall::str()
{
AfxMessageBox("Hello");
}
return false;
And i want to call str(); in .h file.
|
|
|
|
|
What I can see is this is a method of a class, not C-type function. You cannot call a method of a class that way.
Either you should create an instance of the class or you should declare the method as static.
modified 7-Mar-17 16:31pm.
|
|
|
|
|
cpvc++ wrote: return false;
Did this return statement escape?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Here's the problem:
I need to create a class "String" that is implemented as a linked list. This class should include the following string operations:
• String input and output
• A function which returns the string length
• A function which returns the nth character, where the first character is number 1
• Overloaded operators = (assignment), ==, !=, <, >, <= and >= (relational).
I then need to write a class "N" as a subclass of class "String". This class "N" should include an isPostfix Boolean function which determines whether or not a String is a postfix expression, where the operands of the expression are a single lowercase letter, and the operator is +, -, * or /. I will not have to evaluate any postfix expressions.
Does anyone know how do do this or has done this before? Any help would be greatly appreciated. thanks.
|
|
|
|
|
Would you like us to bring you a cup of tea as well?
|
|
|
|
|
shadoweKnight wrote: I then need to write a class...
Which means you, not us.
shadoweKnight wrote: Does anyone know how do do this...
Yes.
shadoweKnight wrote: ...has done this before?
Possibly.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
here is the code that I have so far... again, any help would be appreciated.
#include <iostream>
#include <string>
#include "SimpleString.h"
using namespace std;
SimpleString::output (string S)
{
}
SimpleString::input()
{
}
int SimpleString::getLength()
{
int count = 0;
nodePtr cur;
cur = head;
do
{
count++;
cur =cur->next;
}
while (cur->next != NULL);
return count;
}
char SimpleString::nthChar (int num)
{
nodePtr cur;
cur = head;
for (int x = 0; x <=num; x++)
{
if (cur->next != NULL)
cur = cur->next;
}
return cur;
}
bool operator= (SimpleString& S)
{
if (size = S.getLength())
return true;
else
return false;
}
bool operator== (SimpleString& S)
{
if (size == S.getLength())
return true;
else
return false;
}
bool operator!= (SimpleString& S)
{
if (size != S.getLength())
return true;
else
return false;
}
bool operator< (SimpleString& S)
{
if (size < S.getLength())
return true;
else
return false;
}
bool operator> (SimpleString& S)
{
if (size > S.getLength())
return true;
else
return false;
}
bool operator >= (SimpleString& S)
{
if (size >= S.getLength())
return true;
else
return false;
}
bool operator <= (SimpleString& S)
{
if (size <= S.getLength())
return true;
else
return false;
}
bool isPostfix ()
{
}
</string></iostream>
#include <iostream>
#include <string>
#include "List.h"
using namespace std;
class SimpleString
{
protected:
struct Node
{
char item;
Node *next;
}
Node *head;
head = new Node;
char Node* nodePtr;
int size;
public:
void output (string S);
srtring input();
char getLength();
char nthChar (int num);
bool operator= (const SimpleString& S);
bool operator== (const SimpleString& S);
bool operator!= (const SimpleString& S);
bool operator< (const SimpleString& S);
bool operator> (const SimpleString& S);
bool operator<= (const SimpleString& S);
bool operator>= (const SimpleString& S);
};
class postfixExpression : public SimpleString
{
public:
bool isPostfix();
};</string></iostream>
|
|
|
|
|
There is a short block of code:
<br />
1: typedef deque<int> IntDeque;<br />
2: IntDeque q;<br />
3: IntDeque::iterator it = q.begin();
4: q.push_back(12);<br />
5: if(it==q.end()){<br />
6: cout<<"The end of the deque."<<endl;<br />
7: }</int>
The code will crash at the 5th line because of a internal exception in STL. But i really need a iterator variable to hold a specified iterator in the deque. For example, if i want it to hold the second iterator no matter i push how many new items into the deque. But, in msdn, the comments about push_back says that, this function "Inserting the element invalidates all iterators, but no references, to existing elements". This might be the reason. I tested this code in VC6 and VC2005 and got the same error.
But, this code will work well under Linux platform.
So, i wanna know if this is a difference about the implements of STL deque between MS and Linux?
|
|
|
|
|
kcynic wrote: This might be the reason
the docs says it is. i'd trust them.
|
|
|
|
|
btw, do you know mkvtoolnix? there has some code in it. so, it will crash because of such problem.
|
|
|
|
|
kcynic wrote: So, i wanna know if this is a difference about the implements of STL deque between MS and Linux?
Both MS and Linux implements the STL and follow the standards (well, you would suppose so ). In this particular case, the STL is probably saying that accessing an invalid iterator leads to undefined results. So, MS and Linux simply implement the undefined behavior differently.
|
|
|
|
|
Hello!
I have hwnd of a window I found using FindWindow(), and I want to wait until the user will close this window.
I can think of 2 approches:
(1) better one - get a callback or wait (like waitforsingleobject) until the user closes the window.
(2) not as good as I want - recheck a function that returns the window's state.
I'm looking for a while for a function that does one of these, but with no luck...
Anyone can help me with that???
Thanks a lot in advance!
|
|
|
|
|
SetWindowsHookEx using the WH_CBT hook and looking for the HCBT_DESTROYWND flag. See MSDN for more info.
|
|
|
|
|
try this:
SetTimer(...., TimerProc);
.
.
.
... TimerProc (...)
{
if(IsWindow(hWnd)
}
Thank you masters!
|
|
|
|
|
|
Hi,
I am using the following method to get the scancode for the keyboard keys.But it fails to give me the scancode for F1 to F12 keys. Please tell me what can i do to retrieve the scan code for the above said keys.
UINT lKey = (MapVirtualKey(key, 0) << 16) | (1 << 24);
Thanks in advance,
John.
|
|
|
|
|
This
UINT scancode = ::MapVirtualKey(VK_F1, MAPVK_VK_TO_VSC);
gives me a scan code of 0x3B. Isn't that the F1 scan code?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I try to resize a Custom Control in the OnSize Function of my Views OnSize Function. There is no Error, but nothing happens:
afx_msg void CCustomView::OnSize(UINT nType, int cx, int cy) {
if (::IsWindow(m_datagrid)) {
m_datagrid.SetWindowPos(&wndTopMost, 12, 48, 500, 500, SWP_NOZORDER | SWP_NOMOVE);
}
CView::OnSize(nType, cx, cy);
}
What am I do wrong? m_datagrid.SetWindowPos is executed, I checked it by debugging.
Thank you for your help,
Johannes
|
|
|
|
|
What are you wanting to happen?
You use wndTopMost but it's ignored because of SWP_NOZORDER.
You use x and y positions but they're ignored because of SWP_NOMOVE.
That leaves resize
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yes, it would have been better if I posted the code without the flags.
When I do not use the Flags it`s the same thing: My Custom control is not be resized and not moved, and this is what I want it to do...
|
|
|
|
|
If you want to move and resize, just use MoveWindow().
The other problem may be where you're doing it from.
The view may not get a WM_SIZE message after the child window
you're moving is created (until the next time the view is resized).
Put a breakpoint on the SetWindowPos() call to check.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark,
thank you. With MoveWindow() it works!
|
|
|
|