Fix bool type; its actually 1 byte not 4 in structs. Bug reported by jedahu
parent
4ee5815843
commit
58d0e17936
|
@ -409,10 +409,10 @@ CONSTANT: primitive-types
|
|||
"uchar" define-primitive-type
|
||||
|
||||
<c-type>
|
||||
[ alien-unsigned-4 zero? not ] >>getter
|
||||
[ [ 1 0 ? ] 2dip set-alien-unsigned-4 ] >>setter
|
||||
4 >>size
|
||||
4 >>align
|
||||
[ alien-unsigned-1 zero? not ] >>getter
|
||||
[ [ 1 0 ? ] 2dip set-alien-unsigned-1 ] >>setter
|
||||
1 >>size
|
||||
1 >>align
|
||||
"box_boolean" >>boxer
|
||||
"to_boolean" >>unboxer
|
||||
"bool" define-primitive-type
|
||||
|
|
|
@ -588,3 +588,16 @@ FUNCTION: complex-float ffi_test_47 ( complex-float x, complex-double y ) ;
|
|||
C{ 1.0 2.0 }
|
||||
C{ 1.5 1.0 } ffi_test_47
|
||||
] unit-test
|
||||
|
||||
! Reported by jedahu
|
||||
C-STRUCT: bool-field-test
|
||||
{ "char*" "name" }
|
||||
{ "bool" "on" }
|
||||
{ "short" "parents" } ;
|
||||
|
||||
FUNCTION: short ffi_test_48 ( bool-field-test x ) ;
|
||||
|
||||
[ 123 ] [
|
||||
"bool-field-test" <c-object> 123 over set-bool-field-test-parents
|
||||
ffi_test_48
|
||||
] unit-test
|
|
@ -319,3 +319,8 @@ _Complex float ffi_test_47(_Complex float x, _Complex double y)
|
|||
{
|
||||
return x + 2 * y;
|
||||
}
|
||||
|
||||
short ffi_test_48(struct bool_field_test x)
|
||||
{
|
||||
return x.parents;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#if defined(i386) || defined(__i386) || defined(__i386__) || defined(WIN32)
|
||||
#define F_STDCALL __attribute__((stdcall))
|
||||
#else
|
||||
|
@ -102,3 +104,11 @@ F_EXPORT _Complex float ffi_test_45(int x);
|
|||
F_EXPORT _Complex double ffi_test_46(int x);
|
||||
|
||||
F_EXPORT _Complex float ffi_test_47(_Complex float x, _Complex double y);
|
||||
|
||||
struct bool_field_test {
|
||||
char *name;
|
||||
bool on;
|
||||
short parents;
|
||||
};
|
||||
|
||||
F_EXPORT short ffi_test_48(struct bool_field_test x);
|
||||
|
|
Loading…
Reference in New Issue