views:

222

answers:

3

When generating a COM dll with VisualStudio, all I really need is the DllCanUnloadNow symbol (and three related ones) to be exported from the dll itself. Nobody is going to link against my library, so I'm not (at all) interested in a .lib file, nor in an .exp file.

However, I don't manage to inhibit creation of these files. (note: I do know how it's possible to remove them in a post-build step)

These are my linker arguments:

/OUT:"u:/cada-nt/bin/PData.dll" 
/INCREMENTAL:NO 
/NOLOGO 
/DLL 
/MANIFEST:NO 
/DEF:"PData.def" 
/DEBUG 
/PDB:"u:/cada-nt/pdb/PData.pdb" 
/ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
                    advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
                    odbc32.lib odbccp32.lib

The question:

  • Has anyone succeeded in not generating the .lib and .exp files?
  • Does anyone know why these files are generated?
+1  A: 

why is it a problem to generate these files? Surely if people aren't going to link directly to them all you need to do is not distribute those files and simply distribute the DLL only.

Goz
There is no urgent problem. I even have a workaround. It's just useless that the linker generate them. The files are automatically on the output folder, next to the dll that I need to distribute. It clutters. It annoys.
xtofl
TBH I'd reckon its so low down on the list of things to do, for obvious reasons, that noone has ever bothered doing it.
Goz
-1: this is a perfectly reasonable request. I request it too, for the same reasons, those files are annoying.
demoncodemonkey
@demoncodemonkey: Get used to it. I suspect you also want to get rid of those annoying obj files too ...It shocks me that some people worry about something so inconsequential and, in the end, utterly useful.
Goz
No the obj files are not so annoying because they go in the intermediate directory. The exp and lib are in my nice clean output directory... and that's the difference.
demoncodemonkey
+1  A: 

Not sure how to turn them off, but you can make a post-build step to remove them, like this:

del $(OutDir)\$(ProjectName).lib
del $(OutDir)\$(ProjectName).exp

(on VS2008 it's [Project]->[Properties], then Configuration Properties->Build Events->Post-Build Events)

(note I realise you know how to do this, but this answer may help the next googler...)

demoncodemonkey
A: 

Also you can remade output adresses for both that files to something like that: $(Configuration)\$(TargetName).lib By editing this properties window key: Configuration properties/Linker/Advanced/Import library