vendredi 6 mars 2015

Preserving locally allocated string without references in C



I need an ability to create some string identifiers from inside the local scope of C functions, which will be placed by a linker to some not loadable section, or to a dedicated section that I could strip out without causing any failure to my program.


I have tried #pragma ident “string” or #ident “string”, both do the work, but my “string” parameter is generated by a macro and in fact after expansion it looks like #pragma ident “string1” “string2” and therefore only “string1” is being dumped into .comment section.


So what I need is a way to concatenate strings in pre-processing time to make it look like #pragma ident “string1 string2” or some other approach to preserve unreferenced strings in a dedicated section without generating extra code.




Aucun commentaire:

Enregistrer un commentaire