pea
developer
Hi all
could somebody please explain to me the include file 'cpp_prototypes.h' in Mr.Mirkos SDK? It is included at the bottom of 'gp32.h' and basically looks like this:
Note: I have obviously removed some for the example above and replaced them with ......
I know that it makes available all the Mirko library functions, but what I would like to know is, why are we redefining the prototypes if __cplusplus is defined? If cplusplus is defined, does the compiler ignore the #include files at the top of the file or something???
could somebody please explain to me the include file 'cpp_prototypes.h' in Mr.Mirkos SDK? It is included at the bottom of 'gp32.h' and basically looks like this:
Code:
#ifndef GP32_CPLUSPLUS_H
#define GP32_CPLUSPLUS_H
#include <fileio.h>
#include <sprite.h>
......
#include all other headers in the library here
#ifdef __cplusplus
extern "C" {
#endif
#ifndef size_t
#define size_t int
#endif
// gp_cpuspeed.c
int gp_getPCLK();
int gp_getHCLK();
void gp_setCpuspeed(int freq);
void gp_Reset();
// gp_grafik.c
void gp_drawPixel8 (int x, int y, u8 c, u8 *framebuffer);
void gp_drawPixel16 (int x, int y, u16 c, u16 *framebuffer);
......
PROTOTYPE EVERY FUNCTION IN THE ABOVE INCLUDE FILES
......
// gp_cpuspeed.c
int gp_getPCLK();
GPFILE *smc_fopen(const char *path, const char *mode);
......
void smc_rewind(GPFILE *stream);
int smc_filesize(GPFILE *stream);
#ifdef __cplusplus
}
#endif
#endif
Note: I have obviously removed some for the example above and replaced them with ......
I know that it makes available all the Mirko library functions, but what I would like to know is, why are we redefining the prototypes if __cplusplus is defined? If cplusplus is defined, does the compiler ignore the #include files at the top of the file or something???