【问题标题】:Pygmalion transformation: using "#define DLL" as replacement for "extern "C" __declspec(dllexport)"Pygmalion 转换:使用“#define DLL”替代“extern”C”__declspec(dllexport)”
【发布时间】:2012-07-14 17:53:23
【问题描述】:

有没有办法使用细长的#define 将难看的“”extern \“C\”__declspec(dllexport)”转换成一个迷人的术语“DLL”。
那就是:

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

当然,问题在于 C 周围的嵌入式引号。

【问题讨论】:

  • 它真的需要最外层的引号吗?通常你不会。
  • #define [name] 之后的任何内容都是[name] 的替换,您不需要使用"。

标签: c c-preprocessor declspec


【解决方案1】:

您不需要换行引号。以下是合法的:

#define DLL extern "C" __declspec(dllexport)

【讨论】:

    猜你喜欢
    • 2016-03-25
    • 2022-01-05
    • 2018-08-05
    • 1970-01-01
    • 2012-04-14
    • 1970-01-01
    • 2011-01-18
    • 1970-01-01
    • 2023-01-26
    相关资源
    最近更新 更多