LINUX系のDLL利用はどうなるでしょうか

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
ちゃんこ

LINUX系のDLL利用はどうなるでしょうか

#1

投稿記事 by ちゃんこ » 8年前

Windows系ではDLLを利用するために、
DLLファイルをシステム⇒詳細設定⇒環境⇒pathに所定DLLファイルの所在場所を設定しなければ、
APP起動の時点か、そのDLLをコールされる時点(遅延DLLの場合)がエラーになります。

LINUX系でのDLLを利用する場合もシステムのどっかに設定しておかなければならないのでしょう。

ご教授お願いします。

かずま

Re: LINUX系のDLL利用はどうなるでしょうか

#2

投稿記事 by かずま » 8年前

環境変数 LD_LIBRARY_PATH に設定しておけばよいでしょう。

ちゃんこ

Re: LINUX系のDLL利用はどうなるでしょうか

#3

投稿記事 by ちゃんこ » 8年前

ありがとうございます。
LINUX系ではDLLを探すためのデフォルトディレクトリーはないでしょうか。
またどうぞよろしくお願いします。

みえ
記事: 23
登録日時: 8年前

Re: LINUX系のDLL利用はどうなるでしょうか

#4

投稿記事 by みえ » 8年前

DLL は Windows の用語で、Linux には存在しません。Shared Object のことだと推測すると、下記 ld.so のマニュアルに書いてある通りだと思います。/lib と /usr/lib がデフォルトのようです。

ld.so(8) - Linux manual page
http://man7.org/linux/man-pages/man8/ld.so.8.html
When resolving shared object dependencies, the dynamic linker first
inspects each dependency string to see if it contains a slash (this
can occur if a shared object pathname containing slashes was
specified at link time). If a slash is found, then the dependency
string is interpreted as a (relative or absolute) pathname, and the
shared object is loaded using that pathname.

If a shared object dependency does not contain a slash, then it is
searched for in the following order:

(中略)

o In the default path /lib, and then /usr/lib. (On some 64-bit
architectures, the default paths for 64-bit shared objects are
/lib64, and then /usr/lib64.) If the binary was linked with the
-z nodeflib linker option, this step is skipped.
オフトピック
Windows の DLL の場合は、環境変数の PATH よりも EXE と同じディレクトリにある DLL が優先されるはずです。

返信

“C言語何でも質問掲示板” へ戻る