This is the mail archive of the libffi-discuss@sources.redhat.com mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libffi declaration mystery


Hi all,

This might show a basic misunderstanding in my C skills (or the lack of :) but 
I can't figure this out.

In libffi/include/ffi.h there is this:

/* These are defined in ffi.c */
extern ffi_type ffi_type_void;
extern ffi_type ffi_type_uint8;
extern ffi_type ffi_type_sint8;
extern ffi_type ffi_type_uint16;
extern ffi_type ffi_type_sint16;
extern ffi_type ffi_type_uint32;
extern ffi_type ffi_type_sint32;
extern ffi_type ffi_type_uint64;
extern ffi_type ffi_type_sint64;
extern ffi_type ffi_type_float;
extern ffi_type ffi_type_double;
extern ffi_type ffi_type_longdouble;
extern ffi_type ffi_type_pointer;

extern ffi_type ffi_type_ushort;
extern ffi_type ffi_type_sint; 
extern ffi_type ffi_type_uint; 
extern ffi_type ffi_type_slong; 
extern ffi_type ffi_type_ulong;

The comment is wrong. There is no place in libffi where the vars are defined, 
yet they are used in quite a lot of places:

bo@pluto:519> grep -r ffi_type_float gcc/mainline/libffi               
[~/Work]
gcc/mainline/libffi/src/ffitest.c:    args[0] = &ffi_type_float;
gcc/mainline/libffi/src/ffitest.c:    args[1] = &ffi_type_float;
gcc/mainline/libffi/src/ffitest.c:    args[0] = &ffi_type_float;
gcc/mainline/libffi/src/ffitest.c:      args[ul] = &ffi_type_float;
gcc/mainline/libffi/src/ffitest.c:                     &ffi_type_float, args) 
== FFI_OK);
gcc/mainline/libffi/src/ffitest.c:      cl_arg_types[1] = &ffi_type_float;
gcc/mainline/libffi/include/ffi.h.in:extern ffi_type ffi_type_float;

How can it be legal to define used vars with extern only declarations?

Bo.

-- 

     Bo Thorsen                 |   Praestevejen 4
     Free software developer    |   5290 Marslev
     SuSE Labs                  |   Denmark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]