This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: libffi 3.2.1 and master, can't build with Visual Studio 2012
- From: Richard Henderson <rth at redhat dot com>
- To: GrÃgory Pakosz <gpakosz at myscript dot com>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>
- Cc: "nield dot a dot d at gmail dot com" <nield dot a dot d at gmail dot com>, "rth at twiddle dot net" <rth at twiddle dot net>
- Date: Tue, 18 Nov 2014 17:02:05 +0100
- Subject: Re: libffi 3.2.1 and master, can't build with Visual Studio 2012
- Authentication-results: sourceware.org; auth=none
- References: <1416324204734 dot 161 at myscript dot com>
On 11/18/2014 04:23 PM, GrÃgory Pakosz wrote:
> âHello,
>
> I would like to inform you it's not possible to build libffi 3.2.1 with Visual Studio 2012 anymore as it's not a C99 compiler.
>
> In src/x86/ffi.c,
>
> - src/x86/ffi.c doesn't compile because
> - commit 098dca6b31e declares "size_t z" variables not at the beginning of blocks which is possible in C99 only
> - commit 5d6340ef2cf8 moves "int i" variable declaration from beginning to middle of block
> - this appears to be fixed in master by commit b21ec1ce783â though
These are simply oversights that can easily be fixed.
> static const struct abi_params abi_params[FFI_LAST_ABI] = {
> [FFI_SYSV] = { 1, 0 },
> [FFI_THISCALL] = { 1, 1, { R_ECX } },
> [FFI_FASTCALL] = { 1, 2, { R_ECX, R_EDX } },
> [FFI_STDCALL] = { 1, 0 },
> [FFI_PASCAL] = { -1, 0 },
> [FFI_REGISTER] = { -1, 3, { R_EAX, R_EDX, R_ECX } },
> [FFI_MS_CDECL] = { 1, 0 }
> };
This one's tricky, without simply forcing X86 an X86_WIN32 to have the same
ffi_abi enumeration. Currently, while they have the same symbols, the symbols
have different values. So *not* using designated initializers is hard.
I suppose we could fill in the values at runtime from a switch statement,
but read-only data appeals to me...
And all of that's moot without re-porting the assembly back to masm, which I
was not looking forward to doing.
I have downloaded the recently released gratis VS 2013 Community, but I havn't
yet looked into it enough to figure out how to actually do things with it.
Do I really have to create some sort of project to get things to build, or
is there a command-line compiler included?
How are you building libffi with VS?
r~