Search code examples
cc-preprocessordeclspec

Pygmalion transformation: using "#define DLL" as replacement for "extern "C" __declspec(dllexport)"


Is there a way to use a svelte #define to transform the unsightly ""extern \"C\" __declspec(dllexport)" into a single, enchanting term "DLL".
That is:

#define DLL "extern "C" __declspec(dllexport)"

The problem, of course, is the embedded quote marks around the C.


Solution

  • You don't need the wrapping quotes. The following is legit:

    #define DLL extern "C" __declspec(dllexport)