dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: [RESOLVED] Issue with the Dll

  1. #1
    Join Date
    May 2015
    Posts
    218

    [RESOLVED] Issue with the Dll

    Hi ,
    I have created the Dll for my functionality.

    Now the client given me the test harness and i added my dll into that . But there is no luck, it says that the
    fatal error LNK1107: invalid or corrupt file: cannot read at

    But then i added the visual studio project created within the Dll into the test harness solution and also copied my files in the same folder. Then compiled the test harness soliution. Then I could see the dlll getting loaded properly.
    There is a call within the test harness like dll->GetPropModel(). I can see the My dll is getting called when i put the breakpoint at this point.

    It is frustrating. That now all the functionality is tested with this method. And finally i cannot deliver my code to client as it is not recognising my Dll individually.

    My code has some has some lib and tlb files. Does it package under the same dll or is it because of this i cannot packahge my code under one dll.

    Thanks
    Pdk

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    Re: Issue with the Dll

    Well, you are alone with this error: https://www.google.com/search?q=LNK1...hrome&ie=UTF-8
    Did you read how the others tried to solve this problem?
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,921

    Re: Issue with the Dll

    LNK1107 usually means that you are trying to link to a .dll file instead of a .lib file. When a .dll file is compiled the .lib file will also be generated. This is the file that is used to link - not the .dll file.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.4.0)

  4. #4
    Join Date
    May 2015
    Posts
    218

    Re: Issue with the Dll

    Quote Originally Posted by 2kaud View Post
    LNK1107 usually means that you are trying to link to a .dll file instead of a .lib file. When a .dll file is compiled the .lib file will also be generated. This is the file that is used to link - not the .dll file.
    Thanks a lot kaud. I was adding the .dll under Project->Configuration Properties->Linker->Input->Additional Dependencies.
    Now changed to .lib and everything works like magic. My big big headache is gone.
    Thanks a lot kaud. Much appreciated.

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,173

    Re: [RESOLVED] Issue with the Dll

    Say, as an aside, do you realize you can debug the dll by setting the path to the exe that loads your dll?

    In VC 2019 (previous versions are similar):
    Right click on the dll project and choose properties.
    Click on the Debugging node under Configuration Properties.
    Change the Command property to point to the exe that loads the dll.
    When you debug, the exe will start which loads your dll.

  6. #6
    Join Date
    May 2015
    Posts
    218

    Re: [RESOLVED] Issue with the Dll

    Thanks a lot Arjay, will try this

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)