连接到DLL库? [英] Connecting to DLL library?

查看:118
本文介绍了连接到DLL库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨伙计:

  在VS 2017社区开发,Win 10 Pro,所有C ++,没有MFC。 

   Developing on VS 2017 Community, Win 10 Pro, all C++, no MFC. 

  我有时会使用其他来源的图书馆。 我不记得遇到这个问题。 

   I sometimes use libraries from other sources.  I don't remember running into this problem. 

  我正在尝试链接到Botan加密库。 我在执行调试版本时收到此警告:

   I'm trying to link to the Botan crypto library.  I'm getting this warning when performing debug builds:

6>d:\utilities\code\windows_files\headers\botan\exceptn.h(22):
warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 'Botan::Exception'

  有问题的异常类:

   The exception class in question:

/**
* Base class for all exceptions thrown by the library
*/
class BOTAN_DLL Exception : public std::exception
   {
   public:
      explicit Exception(const std::string& msg) : m_msg(msg) {}
      Exception(const char* prefix, const std::string& msg) : m_msg(std::string(prefix) + " " + msg) {}
      const char* what() const BOTAN_NOEXCEPT override { return m_msg.c_str(); }
   private:
      std::string m_msg;
   };

  我不想改变Botan图书馆的来源。 我愿意将参数更改为其构建脚本。 

   I don't want to alter the Botan library's source.  I am open to changing parameters to its build script. 

  我需要做什么,源代码或构建参数,以避免此警告?

   What do I need to do on my end, source code or build parameters, to avoid this warning?

     谢谢你
     拉里

      Thanks
      Larry

推荐答案

据我所知,警告是因为std :: exception不是导出的类而引起的。 根据

https://social.msdn.microsoft.com/Forums/en-US/d3eb2bb6-03eb-4a2e-9c1a-94821905ba3f/warning-c4275-non-dllinterface-class?forum = vclanguage
如果使用相同的编译器构建指定了/ MD的所有模块,以便
共享相同的运行时,则可以安全地忽略此警告。

As I understand it the warning is caused because std::exception is not an exported class.  According to the discussion at https://social.msdn.microsoft.com/Forums/en-US/d3eb2bb6-03eb-4a2e-9c1a-94821905ba3f/warning-c4275-non-dllinterface-class?forum=vclanguage this warning may be safely ignored if the same compiler is used to build all modules with /MD specified so that they share the same runtime.





这篇关于连接到DLL库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆