2

Cヘッダーファイルからこのfoo.specようなファイルを作成するにはどうすればよいですか?

つまり、ヘッダーファイルのすべての宣言を次のような単純なものに変換する自動化された方法を探しています。

stdcall CreateFileW(wstr long long ptr long long long)

後で簡単に操作できます。一部のタイプでは不可能かもしれませんが、多くの場合は可能であるはずです。

どうすればよいですか?

4

1 に答える 1

1

わかりました。ワインプロジェクトで使用される可能性のあるツールがあります:http ://www.winehq.org/docs/winedump

イントロ:

winedumpは、以下を支援することを目的としたWineツールです。

   A: Reimplementing a Win32 DLL for use within Wine, or
   B: Compiling a Win32 application with Winelib that uses x86 DLLs
  For both tasks in order to be able to link to the Win functions some
  glue code is needed.  This 'glue' comes in the form of a .spec file.
  The .spec file, along with some dummy code, is used to create a
  Wine .so corresponding to the Windows DLL.  The winebuild program
  can then resolve calls made to DLL functions.

  Creating a .spec file is a labour intensive task during which it is
  easy to make a mistake. The idea of winedump is to automate this task
  and create the majority of the support code needed for your DLL. In
  addition you can have winedump create code to help you re-implement a
  DLL

スペック生成モード:

スペックモード:

  <dll>  Use dll for input file and generate implementation code.

...。

foo.dllのスペックモードで出力されるファイル:

  foo.spec

         This is the .spec file.

  foo_dll.h
  foo_main.c

         These are the source code files containing the minimum set
         of code to build a stub DLL. The C file contains one
         function, FOO_Init, which does nothing (but must be
         present).

  Makefile.in

         This is a template for 'configure' to produce a makefile. It
         is designed for a DLL that will be inserted into the Wine
         source tree.

したがって、winedumpはDLLインターフェイスをSPECファイルにダンプします。Specファイルは手動で追加編集できます。

また、仕様では、高水準言語インターフェイスではなく、実際のDLLインターフェイスについて説明しています(.hヘッダーにエンコードされているなど)。したがって、win32のコード(.hと.c、およびDLL関数番号を修正するための.defなど)を通常どおりDLLにコンパイルしてから、DLLから仕様をダンプすることができます。

于 2011-12-04T04:25:36.837 に答える