Mercurial > mxe-octave
annotate src/libffi-test.c @ 3705:d30ced3f489e
libpng: update to 1.6.13
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 02 Sep 2014 11:45:16 -0400 |
parents | 14b3f5ea78ae |
children |
rev | line source |
---|---|
2351
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
1 /* |
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
2 * This file is part of MXE. |
2353
99516e73b368
Move doc/index.html -> index.html
Volker Grabsch <vog@notjusthosting.com>
parents:
2351
diff
changeset
|
3 * See index.html for further information. |
2351
8a6c466753e2
Improve comment style of all test programs
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
4 */ |
1991
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
5 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
6 #include <stdio.h> |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
7 #include <ffi.h> |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
8 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
9 int main(int argc, char *argv[]) |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
10 { |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
11 ffi_cif cif; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
12 ffi_type *args[1]; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
13 void *values[1]; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
14 char *s; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
15 int rc; |
2358
14b3f5ea78ae
Cleanup coding style via "make cleanup-style"
Volker Grabsch <vog@notjusthosting.com>
parents:
2353
diff
changeset
|
16 |
1991
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
17 (void)argc; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
18 (void)argv; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
19 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
20 args[0] = &ffi_type_pointer; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
21 values[0] = &s; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
22 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
23 if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, |
2289
125d60dc0659
Fix annoying TABs and missing newlines at EOF
Volker Grabsch <vog@notjusthosting.com>
parents:
1991
diff
changeset
|
24 &ffi_type_uint, args) == FFI_OK) |
1991
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
25 { |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
26 s = "Hello World!"; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
27 ffi_call(&cif, FFI_FN(puts), &rc, values); |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
28 s = "Goodbye!"; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
29 ffi_call(&cif, FFI_FN(puts), &rc, values); |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
30 } |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
31 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
32 return 0; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
33 } |