[英]how to use exe project as dll?
I created some project that contains a class ( using them as object instance ). 我创建了一个包含类的项目(将它们用作对象实例)。 This project was POC to check some possibility -
此项目是POC,用于检查某些可能性-
Now I want to convert this project to dll - and import this dll to some other exe project. 现在,我想将此项目转换为dll-并将此dll导入其他一些exe项目。
I change the configuration Type of the project to "Dynamic Library ( .dll)" - and compile its ok. 我将项目的配置类型更改为“动态库(.dll)”,并进行编译。
But how I import this dll to my new exe project and use those classes from the other exe ? 但是,如何将这个dll导入到我的新exe项目中,并从其他exe使用这些类?
Do I need to add some "dllExport" definition in some place on the dll project? 我是否需要在dll项目的某个位置添加一些“ dllExport”定义?
You will need to define a separate entry point for a DLL. 您将需要为DLL定义一个单独的入口点。 An executable has the standard entry point:
可执行文件具有标准入口点:
int main(int argc, char* argue[], char* envy[]);
However for a Windows DLL, you need to define dllmain which will be called when the module is loaded and unloaded: 但是,对于Windows DLL,您需要定义dllmain ,在加载和卸载模块时将调用dllmain :
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved);
Further reading on Dynamic Link Libraries . 关于动态链接库的进一步阅读。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.