comparison test/callf/main.c @ 371:451299d50c1a

- windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster! - minor cleanups
author Tassilo Philipp
date Fri, 25 Dec 2020 18:07:39 +0100
parents 3ff4a4ba7f0e
children 7d9f526dc2ad
comparison
equal deleted inserted replaced
370:fa78490381f3 371:451299d50c1a
4 Library: test 4 Library: test
5 File: test/callf/main.c 5 File: test/callf/main.c
6 Description: 6 Description:
7 License: 7 License:
8 8
9 Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 9 Copyright (c) 2007-2020 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com> 10 Tassilo Philipp <tphilipp@potion-studios.com>
11 11
12 Permission to use, copy, modify, and distribute this software for any 12 Permission to use, copy, modify, and distribute this software for any
13 purpose with or without fee is hereby granted, provided that the above 13 purpose with or without fee is hereby granted, provided that the above
14 copyright notice and this permission notice appear in all copies. 14 copyright notice and this permission notice appear in all copies.
111 dcCallF(vm, &ret, (void*)&vf_ffiV, "_effi_.ddiddi)i", 1.f, 2.f, 3, 4., 5., 6, 7., 8., 9); 111 dcCallF(vm, &ret, (void*)&vf_ffiV, "_effi_.ddiddi)i", 1.f, 2.f, 3, 4., 5., 6, 7., 8., 9);
112 r = ret.i && r; 112 r = ret.i && r;
113 113
114 /* arg binding then call using 'formatted' API */ 114 /* arg binding then call using 'formatted' API */
115 dcReset(vm); 115 dcReset(vm);
116 /* reset calling convention too */
117 dcMode(vm, DC_CALL_C_DEFAULT);
116 printf("\nargf iii)i then call: "); 118 printf("\nargf iii)i then call: ");
117 dcArgF(vm, "iii)i", 1, 2, 3); 119 dcArgF(vm, "iii)i", 1, 2, 3);
118 r = r && dcCallInt(vm, (void*)&vf_iii); 120 r = r && dcCallInt(vm, (void*)&vf_iii);
119 121
120 dcReset(vm); 122 dcReset(vm);
130 dcReset(vm); 132 dcReset(vm);
131 printf("\nargf ffiffiffi then call: "); 133 printf("\nargf ffiffiffi then call: ");
132 dcArgF(vm, "ffiffiffi", 1.f, 2.f, 3, 4.f, 5.f, 6, 7.f, 8.f, 9); 134 dcArgF(vm, "ffiffiffi", 1.f, 2.f, 3, 4.f, 5.f, 6, 7.f, 8.f, 9);
133 r = r && dcCallInt(vm, (void*)&vf_ffiffiffi); 135 r = r && dcCallInt(vm, (void*)&vf_ffiffiffi);
134 136
135 #if defined(DC_UNIX) 137 #if defined(DC_UNIX) && !defined(DC__OS_MacOSX) && !defined(DC__OS_SunOS)
136 /* testing syscall using calling convention prefix - not available on all platforms */ 138 /* testing syscall using calling convention prefix - not available on all platforms */
137 dcReset(vm); 139 dcReset(vm);
138 printf("\ncallf _$iZi)i"); 140 printf("\ncallf _$iZi)i");
139 fflush(NULL); /* needed before syscall write as it's immediate, or order might be incorrect */ 141 fflush(NULL); /* needed before syscall write as it's immediate, or order might be incorrect */
140 dcCallF(vm, &ret, (DCpointer)(ptrdiff_t)SYS_write, "_$iZi)i", 1/*stdout*/, " = syscall: 1", 13); 142 dcCallF(vm, &ret, (DCpointer)(ptrdiff_t)SYS_write, "_$iZi)i", 1/*stdout*/, " = syscall: 1", 13);