Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 2797

"a calling convention may not be followed by a nested declarator"

$
0
0

I'm trying to specify a Windows 32 calling convention on a function whose name is a macro, similar to the following:

#define AddPrefix(x) (prefix##x)
#define function AddPrefix(function)
void __cdecl function( void );

int main( int argc, char **argv )
{
    return 0;
}

But the compiler raises the following error:

Intel(R) C++ Compiler XE for applications running on IA-32, Version 13.0.0.089 Build 20120731
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

test.c
test.c(4): error: a calling convention may not be followed by a nested declarator
  void __cdecl function( void );
         ^

compilation aborted for test.c (code 2)

Is there anyway to specify a calling convention on declarations like this?  I need to include a header file with declarations as in my example above into a C file built with -Gz, which causes __stdcall to be the default.  Of course the shared library that matches the header was built without -Gz, so its exports are __cdecl.


Viewing all articles
Browse latest Browse all 2797

Trending Articles



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