小编use*_*758的帖子

如何阻止 GNU GCC 修改 dll 导入函数名称

尽管我在声明中使用了extern "C",但 GNU GCC 正在修改我导入的函数名称。

我刚开始使用 Code::Blocks 和 GNU GCC 从 Borland C++ Builder 6.0 Pro 迁移现有项目并开发一些未来的项目。从长远来看,我将 1) 制作我想交给使用各种平台的最终开发人员的 .dll(即,.dll 不会严格保留在内部。)和 2) 制作程序使用这些 .dll 的代码::块。

当我尝试迁移在 Borland C++ Builder 下运行的第一个项目时,即使我将它们声明为“extern“C”,它也会破坏导入的函数名称。

例如,以下(减少的)代码在编译器开始链接后会产生错误:

   #include <windows.h>

   #include <stdio.h>

   #include <cstdlib>

   #include "dsound.h"

   //#include "CGG_Cpp_DInterface.h"
   //The following are relevent items taken from CGG_Cpp_DInterface.h
   struct CrimsonReply1{
   unsigned int Echo;
   unsigned int Result;
   unsigned int ReplyType;
   unsigned int Reserved1;
   unsigned int Reserved2;
   char* OutputString;
   double Reply[32];
   };

   extern "C" __declspec(dllimport) int CrimsonCommandProc(/*I'm not going to …
Run Code Online (Sandbox Code Playgroud)

c++ gcc codeblocks

5
推荐指数
1
解决办法
1821
查看次数

标签 统计

c++ ×1

codeblocks ×1

gcc ×1