Showing results for 
Search instead for 
Did you mean: 

__FUNCTION__ is not treated as string literal for the purposes of string concatenation

I'm trying to compile some MSC code that contains the following pragma:

void myFunc(int a, double b)
  #pragma comment(linker, "/EXPORT:"__FUNCTION__"="__FUNCDNAME__",PRIVATE")


which handy to define a function alias for an exported function (it's a simpler alternative than creating a MSC .def file which is difficult to maintain).

However the Intel compiler (Version can't concatenate "/EXPORT" with __FUNCTION__

E.g. if you compile the following

int _tmain(int argc, _TCHAR* argv[])
  #pragma message("/EXPORT:"__FUNCTION__"="__FUNCDNAME__",PRIVATE")
  #pragma message(__FUNCTION__"="__FUNCDNAME__",PRIVATE")
 return 0;

the output is

1>------ Build started: Project: ConsoleApplication1 (Intel C++ 15.0), Configuration: Debug Win32 ------
1>  ConsoleApplication1.cpp
1>  /EXPORT:
1>  wmain=wmain,PRIVATE
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I did see an another forum item on the same topic, namely , however that appears to only solve the problem when a string literal is appended to __FUNCTION__ but not when __FUNCTION__ is appended to string literal.

Is there a work-around?











0 Kudos
0 Replies