- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个类,里面有一些静态成员函数。假设类 B
,这个类有一个基类,它来自第三方库,比如 A。现在类 A
已经用 dllimport
和用mingw
我可以毫不费力地构建 sharedlibs 或那个类。构建在其他显然不需要处理导入/导出内容的平台上运行良好。
// export and imports and properly defined.
#define IMPORT __declspec(dllimport)
#define EXPORT __declspec(dllexport)
Class IMPORT A {
public:
static staticOfA();
};
class EXPORT B : public A{
public:
...
static staticOfB()
};
现在这在链接 dll 时给了我 undefined reference 。 undefined reference 错误涉及类 B
的静态和非静态方法。
谁能告诉我为什么?
如果以上信息不充分,请询问,我可以提供。
最佳答案
嗯,这看起来不太好。您始终需要 .h 文件中的通心粉,因为在构建 DLL 时需要导出类,但在客户端代码中使用 .h 文件时需要导入 .
标准模式是:
#ifdef BUILDING_FOO
#define EXPORTED __declspec(dllexport)
#else
#define EXPORTED __declspec(dllimport)
#endif
class EXPORTED A {
// etc..
};
并且只有在构建 DLL 时才定义 BUILDING_FOO。
我真的不知道你打算用 B 类做什么。如果它真的应该被导入,那么它属于另一个 DLL 项目的另一个 .h 文件。
关于c++ - dllimport 或 dllexport 用于使用基类 dllimport 进行类声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23854842/
我有一个用 C 编写的可执行文件,其中包含一些我想从 c# 应用程序中使用的函数。我以前写过很多 dll 并且能够通过添加 __declspec(dllexport) 来使用它们中的函数。到函数声明。
我正在使用 RGiesecke DLLExport 库生成一个 C# DLL,它可以从基于 VC6 构建的遗留应用程序中动态加载。它导出方法并从 VC6 代码中调用它们。没问题。但是,只要我尝试为我的
我得到了这个庞大的项目,其中包含许多在 dll 文件中定义的类。我需要提取该项目的一部分并从该部分创建一个新项目。我已经设法通过使用 Visual Studio 中的代码映射找到了一些 dll 文件,
我已根据 MSDN 文档完成所有操作,但我的函数仍未导出。 LINK1 LINK2 LINK3 这是我的(2 个项目,DLL 和从 dll 导入的应用程序),看起来像这样(简短版): DLL 函数.h
我有一个加载 dll 的 exe。我都写了。 我正在导出一个返回 std::wstring 的函数 foo。 它所做的就是说 std::wstring blah = L"rgjwgfw"; ret
考虑一个简单的类,它只包含内联成员函数。例如: template class Point2D { public: typedef Point2D ThisType; typedef
我有我的dll项目 // .h #pragma once #include extern "C" { void __declspec(dllexport) __stdcall sort(int* v
Microsoft 说:“模板不能与使用 __declspec (dllimport) 或 __declspec (dllexport) 声明的函数一起使用。” (link)。 这是什么意思?我可以导
代码: #ifdef BUILD_DLL #define MY_API __declspec(dllexport) #else #define MY_API __declspec(dllimport)
您好,我对 dllexport 有点困惑。例如,当我在类里面使用 __declspec( dllexport ) 时 #define DllExport __declspec( dllexpor
我试图通过导出为 DLL(在 Windows/VS 2010 上)来保护一些 C++ 代码。 在下面的示例中,var 在父类(super class)构造函数中设置,并且调试器显示它肯定设置为引用某物
我现在正在使用 Visual Studio。我有一个经典的宏来标记 dll api 函数和类。我的理解是标记一个类 dllexport 可以使它的功能从其他二进制文件中可见,从而可以使用 dll 提供
我正在创建一个要在 C# 应用程序中使用的 C 包装器库。在我的 .c 中,函数定义如下: __declspec(dllexport) uint8_t aes132h_nonce(struct aes
这个问题可能类似于 DLL Exports: not all my functions are exported但由于那里没有完全回答,我不得不再问一次。我的情况也是因为使用模板和导出整个类略有不同。
现在我分析一些不是我写的旧代码。在 header 中有许多这样的声明: SVPDSDKDLLEXPORT inline C3vec mult(C3vec src, D3DXMATRIX &m); SV
#if COMPILING_DLL #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT __declspec
我只是 c++ 的初学者,对我来说这似乎是不必要的代码膨胀。我知道 dllimport/export 用于共享 dll 功能,但仅使用公共(public)/私有(private)访问器有什么问题? 如
编辑 为了解决这个问题,我将以下内容添加到头文件(的开头): #ifdef GetMessage #undef GetMessage static inline BOOL GetMessage( LP
我正在考虑为名为 SmartDVB 的软件编写插件。它需要我导出以下函数(这是一个 C++ 示例): BOOL RegisterAddOn(UINT iAddOnId, IAddOnInterface
我想使用 dllexport 导出函数。但是我在编译器“错误 C4439:'WrappedC':签名中具有托管类型的函数定义必须具有 __clrcall 调用约定”时遇到错误。 我在头文件 (.h)
我是一名优秀的程序员,十分优秀!