I'm creating a COM DLL in Visual Studio. The linker generates an import library for the DLL. I don't need the import library.
Is there any way to tell the linker not to generate it?
I'm creating a COM DLL in Visual Studio. The linker generates an import library for the DLL. I don't need the import library.
Is there any way to tell the linker not to generate it?
On
This answer seems to be the solution: https://stackoverflow.com/a/15214141/660440
"Using a .def file containing your exported functions marked with the PRIVATE keyword will tell the linker to skip placing the symbol in your import library."
Nine years later, this may not be useful to the OP, but it may prove useful to others coming by looking for a solution.
LINK.EXE supports the
/NOIMPLIBoption that prevents creation of an import library, even in the presence of a__declspec(dllexport)routine in theDLLorEXEbeing linked.Go to Project Properties, open up the
Linkersection. The very last option isCommand Line. Select that, and there's a place at the bottom to add additional options to the linker. Enter/NOIMPLIBin the edit field, save and apply, and it'll prevent the creation of the.libfile.-- Edit --
Unfortunately, while it does prevent creation of the
.libfile, empirically I've found that the.expfile is still created. I'd file a bug report with MS, but based on past experience with their developer tools team, trying to get something like this fixed will be akin to trying to roll a boulder up hill.-- Edit -- four years later --
As noted in the comments, VS 2019 finally has this fixed, so that
/NOIMPLIBnow suppresses the creation of both the.liband.expfiles.