Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

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

$
0
0

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 15.0.2.179) 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 https://software.intel.com/en-us/articles/treating-func-and-function-as-string-literals , 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?

 

 

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>