LoadLibrary recursive dependencies

Hi,

I have three libraries A.dll, B.dll and C.dll, under directory Lib

A is dependent on B and C.

B and C are also dependent on A.

If I put Lib in system path and load A only, using

System.loadLibrary(A), it works fine, windows somehow knows where to find B and C and load them automatically.

However, if I don't put Lib in system path, and providing the relative path in

system.loadLibrary("lib/A"), Windows will throw an error saying can't find B or C.

So, I put

System.loadLibrary("lib/B");

System.loadLibrary("lib/A")

when loading "lib/B", Windows will throw an error saying "can't find A".

Is there a way that I can resolve this delimma due to the recursive dependencies? Or the only way is to put the lib path in the System Path?

Thanks.

Sincerely,

Stan

[868 byte] By [zzzwyxha] at [2007-10-3 1:35:57]
# 1
Read up on the "search path" for your platform, and put the libraries in one of the search path directories.
bschauwejavaa at 2007-7-14 18:34:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
On Windows you have two choices:set Path=C:\Lib;%Path%java YourClass-or-java -Djava.library.path=C:\Lib YourClassRegards
jfbrierea at 2007-7-14 18:34:02 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

>

> Is there a way that I can resolve this delimma due to

> the recursive dependencies?

The correct solution is to rework that code. That sort of dependency is not a good idea.

> Or the only way is to put

> the lib path in the System Path?

Put in the lib path which you have already proven or rework it.

It suppose you could wrap a third dll which explicitly loads the other two. Where explicit is the key there. That seems like a real hack to me though.

jschella at 2007-7-14 18:34:03 > top of Java-index,Java HotSpot Virtual Machine,Specifications...