Comments (1)
如果在头文件定义类时,直接给定成员函数定义(默认内联),eg sex()
,那么 exe 主程序能够直接看到其定义,所以无需导出。但是像 age()
这种,是需要显式导出后 exe 主程序才能使用
class /*_ADD_API*/ Student
{
public:
/*Student();
~Student();*/
inline int age();
bool sex()
{
return m_sex;
}
_ADD_API void change(std::string name);
private:
int m_age;
bool m_sex;
std::string m_name;
};
from testdll.
Related Issues (20)
- 跨模块拷贝构造传参,拷贝构造发生在哪一个模块? HOT 1
- 有必要深入了解 dllmain 函数吗?optional HOT 1
- 只导出类的成员函数,是什么使用场景?
- dll 导出常规的 C++ 类缺点很多!应该避免 HOT 3
- 动态库中的线程如何自理? HOT 6
- Thread Local Storage
- 即便不导出类,exe 也可以使用 dll 中类型的默认构造与析构 HOT 1
- what-happens-to-global-and-static-variables-in-a-shared-library-when-it-is-dynam
- 为什么使用 YDData2d.lib 导入库编译,运行时还是要找 YDData2.dll 呢? HOT 3
- dll 卸载(unload) HOT 2
- 为什么会多次加载/卸载 dll?——多线程? HOT 1
- YDData2g 无故不能调试 HOT 3
- 传值和传常量引用,在作为公共接口时有区别吗? HOT 2
- swap() 函数意味着重新分配内存吗? HOT 1
- 新标准? HOT 1
- 为什么使用智能指针就能避免跨DLL动态内存管理的问题 HOT 1
- 删掉 dll.DEF 文件中 LIBRARY 字段后面双引号及其内部的库名 HOT 1
- Determining Which Exporting Method to Use HOT 1
- 如何导出内嵌类? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testdll.