I have a problem with the cdecl calling convention:
void Test1(char* str, ...) // ok
{}
void cdecl Test2(char* str, ...) // error: expected initializer before 'Test2'
{}
int main()
{}
What should I do to make the compiler recognize the cdecl calling convention?
Thanks!
Platform: Windows 7; MinGW; GCC 4.6.1
I cannot modify those functions, since they are part of "Microsoft Excel Developer's Kit, Version 14", in the file FRAMEWRK.H:
///***************************************************************************
// File: FRAMEWRK.H
//
// Purpose: Header file for Framework library
//
// Platform: Microsoft Windows
//...
// From the Microsoft Excel Developer's Kit, Version 14
// Copyright (c) 1997 - 2010 Microsoft Corporation. All rights reserved.
///***************************************************************************
...
//
// Function prototypes
//
#ifdef __cplusplus
extern "C" {
#endif
void far cdecl debugPrintf(LPSTR lpFormat, ...);
LPSTR GetTempMemory(size_t cBytes);
void FreeAllTempMemory(void);
...
EDIT Note: this answer (and all answers similar to it) is technically incorrect, as the comments below indicate. I am not removing it, so that we do not lose the comments. (END EDIT)
Prepend it with two underscores, like this: __cdecl