“C”怎么样;规格“;创建这样的文件?

“C”怎么样;规格“;创建这样的文件?,c,dll,wine,C,Dll,Wine,如何创建类似于C头文件的foo.spec文件 i、 e.我正在寻找一种自动化的方法,将所有头文件的声明转换为简单的内容,如: stdcall CreateFileW(wstr long long ptr long long long) 我可以很容易地使用它在以后执行操作。 我意识到这对某些类型可能不可能,但在很多情况下应该是可能的 如何做到这一点?好的,wine项目中可能会用到以下工具: 简介: winedump是一款葡萄酒工具,旨在帮助: 规格生成模式: 等级库模式: <dll&g

如何创建类似于C头文件的
foo.spec
文件

i、 e.我正在寻找一种自动化的方法,将所有头文件的声明转换为简单的内容,如:

stdcall CreateFileW(wstr long long ptr long long long)
我可以很容易地使用它在以后执行操作。 我意识到这对某些类型可能不可能,但在很多情况下应该是可能的


如何做到这一点?

好的,wine项目中可能会用到以下工具:

简介:

winedump是一款葡萄酒工具,旨在帮助:

规格生成模式:

等级库模式:

  <dll>  Use dll for input file and generate implementation code.
所以,winedump将DLL接口转储到SPEC文件。可以手动对等级库文件进行其他编辑


该规范描述的是真实的DLL接口,而不是高级语言接口(就像在
.h
标题中编码的那样)。因此,您可以像往常一样将win32上的代码(.h和.c,或者类似.def的东西来修复DLL函数号)编译为DLL,然后从DLL中转储规范。

您可以编写声明解析器。如果您不处理struct/union/enum并进行最小验证,您将看到大约600行C代码。还不错。或者,如果编译器可以生成一些东西,你可以使用它。亚历克斯,你认为那是手写的吗?@osgx:可能,但我不相信,因为它需要维护(即重做)。为什么?该规范是DLL导出的文本转储,而不是头文件(在MS/goverment之外不应该有内核32的头文件)。如果您的任务模拟DLL接口,请使用winedump;如果您的任务是使用project中定义的函数列表,请使用
ctags
cscope
@osgx:Right。但问题是源代码,而不是二进制文件。啊,这似乎是我需要的——我只是给了它一个源代码和一个DLL,它为我创建了规范。谢谢!
  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.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.