简体   繁体   中英

How to export a DLL from Visual Studio 2017 Community Edition C++ Project?

I have a Visual Studio 2017 Community Edition. Started the new C++ console project. Marked the class I want exported as DLL with __declspec(dllexport).

But when I build my solution, I only get files with following extensions: .exe, .iobj, .ipdb and .pdb.

I tried searching through various settings in Visual Studiom including configuration manager, but I can't find where to enable the option to build the code as DLL. Is it maybe not a part of community edition?

You have to select DLL in Configuration Properties of your project.

Then probably figured out errors, if any


在此处输入图片说明

I have not VS community available right now, but IIRC, in the General project settings, you can select Dynamic Library as the Configuration Type

You may also want to set Map Exports and Generate Map File to Yes or something like that, in the linker Debugging settings.

You probably will also need a

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)     
{
    //you should keep hinstDll in a global variable

    //...

    return true;// true means "go on with loading the dll"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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