0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

.dll から .lib(import lib) を作成するメモ(MinGW, llvm-dlltool)

Last updated at Posted at 2020-06-25

背景

MinGW で, .dll を使うアプリをビルドするのに, リンク用の .lib(import lib)を作成したい.

参考

MS-MPI(Microsoft MPI) の例

手順

  • .dll -> .def(テキスト)を作る
  • .def から .lib(import lib)を作る

.def を作る方法はいくつかりますが(シンボル数が少なければ手書きという手もある), 今回は gendef(mingw tool)を使います.

環境, 必要なツール

Ubuntu 18.04 or later を想定します(e.g. WSL linux)
Linux で完結するようにします.

  • gendef(.dll -> .def)
    • apt で mingw-w64-tools で入ります
  • llvm-dlltool
    • llvm-mingw などであります.
    • MinGW にも dlltool ありますが, うまくいかないときもあるっぽい?

手順

directml.dll を例にとります.

$ gendef directml.dll
$ llvm-dlltool -m i386:x86-64 -d directml.def -l directml.lib

でいけます!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?