Mercurial > mxe-octave
annotate src/libffi-test.c @ 2333:f653602a0500
Rebrand to new project name MXE
author | Volker Grabsch <vog@notjusthosting.com> |
---|---|
date | Wed, 28 Mar 2012 15:46:58 +0200 |
parents | 125d60dc0659 |
children | 8a6c466753e2 |
rev | line source |
---|---|
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
2289
diff
changeset
|
1 /* This file is part of MXE. */ |
1991
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
2 /* See doc/index.html for further information. */ |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
3 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
4 #include <stdio.h> |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
5 #include <ffi.h> |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
6 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
7 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
|
8 { |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
9 ffi_cif cif; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
10 ffi_type *args[1]; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
11 void *values[1]; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
12 char *s; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
13 int rc; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
14 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
15 (void)argc; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
16 (void)argv; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
17 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
18 args[0] = &ffi_type_pointer; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
19 values[0] = &s; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
20 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
21 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
|
22 &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
|
23 { |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
24 s = "Hello World!"; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
25 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
|
26 s = "Goodbye!"; |
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 } |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
29 |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
30 return 0; |
5d0f5094fb66
package libffi: bugfix for build directory and add test program
Tony Theodore <tonyt@logyst.com>
parents:
diff
changeset
|
31 } |