• Welcome to Valhalla Legends Archive.
 

Macros

Started by shout, September 09, 2005, 02:11 PM

Previous topic - Next topic

shout

Confused!


#ifdef STUFF_EXPORTS
#define STUFF_API __declspec(dllexport)
#else
#define STUFF_API __declspec(dllimport)
#endif

#ifdef STUFF_EXPORTS
#define STUFF_C_API __declspec(dllexport) extern "C"
#else
#define STUFF_C_API __declspec(dllimport) extern "C"
#endif


Now lets say I have function n:

STUFF_C_API DWORD n(void *N);

That wraps:

class STUFF_API Cn
{
...
}

It gives me syntax errors. However, the following works.

__declspec(dllexport) extern "C" DWORD n(void *N);

class __declspec(dllexport) Cn
{
...
}

The STUFF_EXPORTS is defined.

The compilers shitfits:
error C2146: syntax error : missing ';' before identifier 'DWORD'
error C2501: 'STUFF_C_API' : missing storage-class or type specifiers
error C2146: syntax error : missing ';' before identifier 'DWORD'

R.a.B.B.i.T

Seeing as how DWORD isn't used in any of the code you showed...well...I hope you get my drift.

shout

Quote from: rabbit on September 09, 2005, 05:35 PM
Seeing as how DWORD isn't used in any of the code you showed...well...I hope you get my drift.

I ment to put DWORD before the n()

R.a.B.B.i.T

If I'm remembering last year correctly, the defines of STUFF_C_API won't include the "extern "C"".

Kp

Post the preprocessor output.  It'll be easier to debug that than to try to guess what your preprocessor is doing.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

shout

I forgot to include the header file the macro was in :/.