DLL generated but related import library is missing?

Hello everyone,


I am building a DLL file. But the related import library file .lib is not generated. I am using Visual Studio 2003. What points should I check in order to generate the import library file


thanks in advance,
George


Answer this question

DLL generated but related import library is missing?

  • waheyluggage

    Thank you Opfer,

    Opfer wrote:

    The linker option for the .lib file is:

    /IMPLIB:"C:\Documents and Settings\<USER>\My Documents\Visual Studio 2005\Projects\<PROJECT>\Release\<DLL>.lib"

    If this option isn't specified, it should output a .lib file in the same directory as your DLL, also with the same name, just the different extension (lib).

    The only command line options that VS adds to the linker when building my DLL (with working .lib file) are (with <DLL> being the name of my DLL):

    link.exe /outputresource:"..\release\<DLL>.dll;#2" /manifest ".\Release\<DLL>.dll.intermediate.manifest"

    1. Do you mean the only option which impacts import library is /IMPLIB

    2. And I think you also mean that even if this option is not specified, import library file is generated. Right

    regards,

    George


  • say_2000

    Cool, thank you Holger!

    Holger Grund wrote:

    You need to either specify a module definition file (.def) or have at least one export (e.g. via __declspec(dllexport) or via the /EXPORT switch - either on the command line or in a ".drectve" section)

    If you have the linker should say something along the lines of "Creating Library xy.lib and object xy.obj".

    You should see the linker output in your build log file.

    -hg

    regards,

    George


  • chendil vanan

    I don't know VS 2003, but the options in VS 2005 should be similiar.

    In the linker settings, under "Advanced" there should be an option "Import Library", which will contain the path of the outputted .lib file. The path may be using macros like "$(TargetDir)$(TargetName).lib", these are just paths which will be replaced with something like "C:\Documents and Settings\user\My Documents\Visual Studio 2003\Projects..." and so on when compiled. You can also write real paths into that field instead of these macros. So you should make sure that you've got a valid filename in there.

    If that doesn't work, maybe check the output window and the build log. If it does output something there should be a line like this:

    "Creating library C:\Documents and Settings\<USER>\My Documents\Visual Studio 2005\Projects\<PROJECT>\Release\<DLL>.lib"


  • Darrin Turner

    Thank you Opfer,

    Opfer wrote:

    1. Well, I don't know if it's the only option that has influence, there might be others, but it's definitely the one specifying the output path and file.

    2. Yeah, my VC++ IDE generates a command line for the linker that doesn't specify this parameter and apparently that leads to the linker outputting a file with the same name in the same directory, just with different file extension.

    I followed Holger's method below and it works.

    regards,

    George


  • Xp3ll3d

    I like to specify the .dll file to be at some different path rather than along with .exe file. How should I configure this

    Regards,
    JayaRam

  • Joseph Geretz

    1. Well, I don't know if it's the only option that has influence, there might be others, but it's definitely the one specifying the output path and file.

    2. Yeah, my VC++ IDE generates a command line for the linker that doesn't specify this parameter and apparently that leads to the linker outputting a file with the same name in the same directory, just with different file extension.


  • MyoZaw

    Thank you Opfer,

    Opfer wrote:

    I don't know VS 2003, but the options in VS 2005 should be similiar.

    In the linker settings, under "Advanced" there should be an option "Import Library", which will contain the path of the outputted .lib file. The path may be using macros like "$(TargetDir)$(TargetName).lib", these are just paths which will be replaced with something like "C:\Documents and Settings\user\My Documents\Visual Studio 2003\Projects..." and so on when compiled. You can also write real paths into that field instead of these macros. So you should make sure that you've got a valid filename in there.

    If that doesn't work, maybe check the output window and the build log. If it does output something there should be a line like this:

    "Creating library C:\Documents and Settings\<USER>\My Documents\Visual Studio 2005\Projects\<PROJECT>\Release\<DLL>.lib"

    I have checked with your method, but it is not working. I want to analyze in the command line parameters which are used to make the build. Do you know which command option is used to specify the generated import library file Any samples

    regards,

    George


  • G.G.

    You need to either specify a module definition file (.def) or have at least one export (e.g. via __declspec(dllexport) or via the /EXPORT switch - either on the command line or in a ".drectve" section)

    If you have the linker should say something along the lines of "Creating Library xy.lib and object xy.obj".

    You should see the linker output in your build log file.

    -hg


  • iuem

    The linker option for the .lib file is:

    /IMPLIB:"C:\Documents and Settings\<USER>\My Documents\Visual Studio 2005\Projects\<PROJECT>\Release\<DLL>.lib"

    If this option isn't specified, it should output a .lib file in the same directory as your DLL, also with the same name, just the different extension (lib).

    The only command line options that VS adds to the linker when building my DLL (with working .lib file) are (with <DLL> being the name of my DLL):

    link.exe /outputresource:"..\release\<DLL>.dll;#2" /manifest ".\Release\<DLL>.dll.intermediate.manifest"


  • winterxu416

    AFAIK the lib file will be created only if you export something .


  • DLL generated but related import library is missing?