Search code examples
x86-6464-bit32bit-64bitwinewinelib

Spec file for a 64-bit DLL wine wrapper


Trying to create a spec file for a WINE wrapper for a Windows 64-bit DLL.

In a 32-bit equivalent project the spec file might have contained something like this:

@ stdcall foo (long ptr) Proxyfoo

In the above example, the functype is stdcall and the WineLib User Guide suggests that all possible values of functype are as follows:-

FUNCTYPE should be one of:

  1. pascal - for a Win16 function
  2. stdcall - for a normal Win32 function
  3. cdecl - for a Win32 function using the C calling convention
  4. varargs - for a Win32 function taking a variable number of arguments
  5. thiscall - for a Win32 function using the C++ calling convention

So what value should be used for a 64-bit function? Or can it just be omitted? The user guide does not suggest it is an optional item.


Solution

  • In x86-64, stdcall, cdecl, and thiscall are all the same calling convention. varargs is the same calling convention too, but Winelib needs to know that the function can have an arbitrary number of arguments.

    I would use cdecl in your specfile because it is the default calling convention on all modern C compilers. That way, if at some point you decide to compile the DLL as 32-bit, the specfile will likely work without any changes.