「DLL」の版間の差分
imported>MikeCAT 作成 |
imported>MikeCAT 細 リンクを追加 |
||
| 4行目: | 4行目: | ||
test.dllのint test(int a)という関数を利用することを考える。 | test.dllのint test(int a)という関数を利用することを考える。 | ||
[[静的リンク]]の利点は[[プログラム]]が簡単になることだが、欠点はDLLがないと起動できなくなることなので、 | |||
拡張機能を提供するには向かない。 | 拡張機能を提供するには向かない。 | ||
逆に、[[動的リンク]]の利点はDLLがなくてもプログラム内で[[エラー処理]]をすればいいことだが、 | |||
プログラムが若干複雑になるという欠点がある。 | プログラムが若干複雑になるという欠点がある。 | ||
===[[C言語]]=== | ===[[C言語]]=== | ||
====静的リンク==== | ====静的リンク==== | ||
1. | 1.[[インポートライブラリ]]を作成する | ||
<pre>>pexports test.dll > test.def | <pre>>pexports test.dll > test.def | ||
>dlltool --dllname test.dll --input-def test.def --output-lib libtest.a</pre> | >dlltool --dllname test.dll --input-def test.def --output-lib libtest.a</pre> | ||
| 120行目: | 120行目: | ||
==DLLの作り方== | ==DLLの作り方== | ||
[[Visual Studio|Visual C#]] | [[Visual Studio|Visual C#]]を使用しても[[拡張子]]が.dllの[[ファイル]]は作れるようだが、ここで扱うDLLとは別物のようである。 | ||
===C言語=== | ===C言語=== | ||
<source lang="c"> | <source lang="c"> | ||