MakerLabs ACM
embedded_files_string_view_wrapper.h
Go to the documentation of this file.
1 /*
2  * Copyright Paul Reimer, 2018
3  *
4  * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Unported License.
5  * To view a copy of this license, visit
6  * https://creativecommons.org/licenses/by-nc-sa/4.0/
7  * or send a letter to
8  * Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
9  */
10 
11 #pragma once
12 
13 #include <experimental/string_view>
14 
15 #define DECLARE_STRING_VIEW_WRAPPER(file_name_with_ext) \
16  extern const char file_name_with_ext ## _start[] \
17  asm("_binary_" #file_name_with_ext "_start"); \
18  extern const char file_name_with_ext ## _end[] \
19  asm("_binary_" #file_name_with_ext "_end"); \
20  const std::experimental::string_view file_name_with_ext( \
21  file_name_with_ext ## _start, \
22  file_name_with_ext ## _end - file_name_with_ext ## _start \
23  )