简体   繁体   English

从Visual Studio项目创建一个配置为生成DLL的lib文件

[英]Creating a lib file from a visual studio project that is configured to generate a DLL

I have project that outputs a dll. 我有输出dll的项目。 Currently I have specified only a few functions to be exported. 目前,我仅指定了一些要导出的功能。 After compilation a dll file is generated and also a .lib file with the few exports that I had. 编译后,将生成一个dll文件以及一个带有我的少量导出文件的.lib文件。 I want to know if there is an easy way so that I can export all the classes to lib file. 我想知道是否有一种简单的方法,以便可以将所有类导出到lib文件。 I cannot possibly add all statements for each class to .def file also I dont want to edit the code to change declaration of each method. 我无法将每个类的所有语句添加到.def文件,也不想编辑代码以更改每个方法的声明。 Is there a visual studio setting that can tell the compiler to export all code. 是否有一个Visual Studio设置可以告诉编译器导出所有代码。

Use __declspec(dllexport) on the class declaration instead of using a .def file. 在类声明上使用__declspec(dllexport)而不是使用.def文件。 Exporting everything doesn't make a lot of sense and is not supported. 导出所有内容没有任何意义,因此不支持。 You pick what should be visible. 您选择应该可见的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM