package libffi: bugfix for build directory and add test program

This commit is contained in:
Tony Theodore 2011-09-19 19:32:19 +10:00
parent 9e943586ae
commit caca5b75f5
2 changed files with 38 additions and 2 deletions

31
src/libffi-test.c Normal file
View File

@ -0,0 +1,31 @@
/* This file is part of mingw-cross-env. */
/* See doc/index.html for further information. */
#include <stdio.h>
#include <ffi.h>
int main(int argc, char *argv[])
{
ffi_cif cif;
ffi_type *args[1];
void *values[1];
char *s;
int rc;
(void)argc;
(void)argv;
args[0] = &ffi_type_pointer;
values[0] = &s;
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
&ffi_type_uint, args) == FFI_OK)
{
s = "Hello World!";
ffi_call(&cif, FFI_FN(puts), &rc, values);
s = "Goodbye!";
ffi_call(&cif, FFI_FN(puts), &rc, values);
}
return 0;
}

View File

@ -24,6 +24,11 @@ define $(PKG)_BUILD
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
--disable-shared
$(MAKE) -C '$(1)' -j '$(JOBS)'
$(MAKE) -C '$(1)' -j 1 install
$(MAKE) -C '$(1)/$(TARGET)' -j '$(JOBS)'
$(MAKE) -C '$(1)/$(TARGET)' -j 1 install
'$(TARGET)-gcc' \
-W -Wall -Werror -std=c99 -pedantic \
'$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-libffi.exe' \
`'$(TARGET)-pkg-config' libffi --cflags --libs`
endef