EmbeddedFile.hxx
Go to the documentation of this file.00001 #ifndef EmbeddedFile_hxx
00002 #define EmbeddedFile_hxx
00003
00008
00009 #if defined __MINGW32__
00010
00011 #define CLAM_EMBEDDED_FILE(varname, file) \
00012 asm ( \
00013 " .section \".rodata\"\n" \
00014 " .def _" #varname "\n" \
00015 " _" #varname ":\n" \
00016 " .incbin \"" file "\"\n" \
00017 " .byte 0\n" \
00018 " .scl 2\n" \
00019 " .size . - _" #varname "\n" \
00020 " .endef\n" \
00021 ); \
00022 extern const char varname[];
00023
00024
00025
00026 #elif defined __ELF__
00027
00028
00029 #define CLAM_EMBEDDED_FILE(varname, file) \
00030 asm ( \
00031 " .section \".rodata\"\n" \
00032 " .type " #varname ", @object\n" \
00033 " " #varname ":\n" \
00034 " .incbin \"" file "\"\n" \
00035 " .byte 0\n" \
00036 " .size " #varname ", .-" #varname "\n" \
00037 ); \
00038 extern const char varname[];
00039 #else
00040 #error "No support for embedded files in your platform"
00041 #define CLAM_EMBEDDED_FILE(varname, file) \
00042 extern const char varname[];
00043 #endif
00044
00045
00047 #define CLAM_EXTERNAL_FILE_DATA(varname, file) CLAM_EMBEDDED_FILE(varname, file)
00048
00049
00050 #endif//EmbeddedFile_hxx