On Jul 12, 5:22 pm, gert <gert.cuyk...@gmail.comwrote:
I am trying my best here to understand the following that you will
find in the header file of expat.h
typedef void (XMLCALL *XML_ElementDeclHandler) (...);
Now for starters what is XMLCALL i dont want to know what it does i
only want to know wat it is ? pointer, integer ?
As a wild guess, I would venture:
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
achieve some different behavior, but doing so it not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
"library boundary." This will default to cdecl, and
try really hard to tell the compiler that's what we
want.
XMLIMPORT - Whatever magic is needed to note that a function is
to be imported from a dynamically loaded library
(.dll, .so, or .sl, depending on your platform).
The XMLCALL macro was added in Expat 1.95.7. The only one which is
expected to be directly useful in client code is XMLCALL.
Note that on at least some Unix versions, the Expat library must be
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
#if defined(_MSC_VER)
#define XMLCALL __cdecl
#elif defined(__GNUC__) && defined(__i386) && !
defined(__INTEL_COMPILER)
#define XMLCALL __attribute__((cdecl))
#else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
#define XMLCALL
#endif
#endif /* not defined XMLCALL */
Next questioin would be whats with all this (XMLCALL
*XML_ElementDeclHandler) ?
Why can it not be somthing like this ?
typedef XMLCALL XML_ElementDeclHandler(...);
Because that would not be the same.
And what about this ?
XMLPARSEAPI (const XML_Char *)
XML_GetBase(...);
Why not
XMLPARSEAPI
XML_GetBase(...);
Now about the example part.
static void XMLCALL
startElement(...){...}
Why not like
static XMLCALL
startElement(...){...}
Ask the package authors about the API choices. Pull out a C manual
and find out what these things mean. You will find that it is faster
than asking here.
P.S.
int foo(void); /* this is a function prototype for a function that
takes no arguments and returns an integer value */
typedef int (*bar)(void); /* This is a typedef for an function pointer
returning int. We could assign foo to an instance of it. */