c++ - DLL 纯虚函数
问题描述
我已经尝试在网上查找此内容,但我仍然有点困惑。
我正在 Visual Studio 中从 c++ 编译一个 dll,并且我有一个带有纯虚拟方法的父类。类本身仅在 dll 内调用,不从外部调用。
#pragma once
#include <string>
class IndicatorBase {
public:
IndicatorBase(const char*, int); // Constructor
double GetValue(); // Gets the value from the indicator
protected:
const char* symbol;
int period;
int handle; // Handle for indicator
void SetupIndicator(); // Creates the indicator
virtual const char* IndicatorName() = 0; // Returns the Indicator Name
virtual void IndicatorParams(std::string & buff) = 0; // Sets the buffer sent in to the parameters
};
与 dll 一起使用时,如何从父函数调用 IndicatorName() 或 IndicatorParams()?
将 dll 导出和导入放在我所有的头文件中是常见的做法吗?
#ifdef MAKEDLL
# define EXPORT __declspec(dllexport)
#else
# define EXPORT __declspec(dllimport)
#endif
试图让 dll 识别我孩子的运行时实现。
谢谢
解决方案
推荐阅读
- python - 如何预测 KeyedVectors word2vec 的输出词?
- androidx - AndroidX 生物识别强制指纹
- r - 如何强制 stslist.freq 到数据框
- c - 警告:spi_register_board_info 未定义
- php - 如何在两个多维数组之间合并尊重他们的键
- java - 如何在 Java 配置中执行以下 XML 配置
- google-sheets - 对范围使用模式并忽略空格
- azure - 在行上发现数据工厂电子邮件错误
- react-admin - React-Admin:禁用 Fitler 的“搜索时键入”
- python-asyncio - 处理异步死锁