Re: .def file library name
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in message
news:Ot0iyEKVJHA.5588@TK2MSFTNGP03.phx.gbl...
I tried using a LIBRARY field with a different name than the output DLL,
and I get a warning during build (with VS2008) that says that the
directive is ignored:
1>TestGmbnDll.exp : warning LNK4070: /OUT:AnotherName.dll directive in
.EXP differs from output filename 'J:\Documents and
Settings\Giovanni\Documenti\Visual Studio
2008\Projects\TEST\MyCodeSnippets1\Debug\TestGmbnDll.dll'; ignoring
directive
Moreover, I can be wrong, but I read on GetModuleBaseName() documentation:
http://msdn.microsoft.com/en-us/library/ms683196.aspx
<quote>
To retrieve the base name of a module in the current process, use the
GetModuleFileName function to retrieve the full module name and then use a
function call such as strrchr(szmodulename, '\\') to scan to the beginning
of the base name within the module name string. This is more efficient and
more reliable than calling GetModuleBaseName with a handle to the current
process.
</quote>
I think the linker switch (perhaps /OUT) supersedes the LIBRARY directive in
the .def file. I'm not sure if it's possible to specify a different library
name than the filename of the DLL. The doc for GetModuleFileName() seems to
indicate the library name *is* the filename, so you may be on to something.
Perhaps the proper place to stamp the DLL with something specific is in the
VERSION info resource, or even more proprietary, exporting a specific
function with a GUID in its name so the caller can try to do a
GetProcAddress() on the DLL to see if it is there; if so, it is the
proprietary DLL being looked for.
-- David