In a VC ++ project in Visual Studio, how do I specify the characters / EXPORT?

I have a makefile project that creates and links a DLL using the cl.exe command line compiler, which is included in the VC ++ Express tool (free). Now I want to convert this makefile project to a Visual Studio project.

The DLL is actually not C ++; it is all written in C.

The DLL exports a small number of characters, functions called by other programs that reference the DLL. I believe that in order to create this DLL, I need to include a /EXPORT:Foolink command statement for each exported symbol.

How do I do the same in Visual Studio 2008? How do I specify linker options to export a specific, small set of functions from a DLL?

+3
source share
4 answers

You will need to use the "Advanced Options" in the linker property "Command Line" and explicitly add the options.

I think most people use attributes __declspec(dllexport)along with macros to make it more usable and make declspec a version of dllimport in the headers for library clients.

+3
source

See the first couple of subsections, Exporting from a DLL , which says:

You can export functions from a DLL using two methods:

(.def) .def DLL. , DLL .

__declspec (dllexport) .

+4

or you can try:

cl /LD hellodll.cpp /link /EXPORT:func01 /EXPORT:func01

for functions not specified in "_declspec(dllexport)"

+2
source

I do not see a GUI parameter for it, so you can simply add it manually at the command line in Linker in the project properties. I think most people use a DEF file for this.

+1
source

Source: https://habr.com/ru/post/1715844/


All Articles