DLL problem on some machines
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: DLL problem on some machines

  1. #1
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    DLL problem on some machines

    Hi, I'm having some problems with a very small app that uses a third party DLL. I can run the app on my computer (Windows 7, 32 bits), and could run it on several XP's, but on other windows 7 computers, the app won't run. I get a "The application stopped working" message, and then it closes. The problem is, I get no exception or anything, so I don't know what is causing the crash (at first glance). I tried putting MessageBox's before the first use of the DLLs resources and it crashes just after that.
    Code:
    MessageBox.Show("So far so good");
    DllClassObject Object1 = new DllClassObject(); // This causes the crash
    MessageBox.Show("This message will only show on XPs or my machine's Win7...");
    
    Object1.Methods(...);
    Every machine I tried this on has the original third party complete software installed so the libraries are correctly registered. And besides, I also put the dll file in the same directory as the exe, so (as far as I know) it should look for it there when needed right?

    Is there anything else I can do? How can I fix this?
    Thank you for reading.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: DLL problem on some machines

    It might be that some other dll is missing on those machines, the correct MSVC runtime for instance. Use Dependency Walker http://www.dependencywalker.com/ to find out if that's the case.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    Re: DLL problem on some machines

    Hi SMA, I would doubt that very much, since I have the original third party complete app already installed and working on the machines, and a second application we developed that also uses that library (written in Delphi) that also works ok. It's my C# app that crashes, and only on Win 7 machines, EXCEPT mine!! =)
    As for MSVC, should I really need that if I'm not intending to develop on that machine? I only want to run the app. It would be a pain to have to install it on the end-user's machine.

  4. #4
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,451

    Re: DLL problem on some machines

    It sounds like the .dlls that are causing the issues may be built for 32 bit OS's. When you build your application, are you building with "Any CPU" If so, what is happening is most likely this. On a 32Bit system, (XP) the application you built is run in 32bit mode and the .dll's you are linking to, work fine. On a 64bit system, your application starts in 32bit mode on your machine, and all runs fine. However, if it is run on a 64Bit system, the .dll signatures won't work and your application crashes.

    Try building your application for "X86".

  5. #5
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    Re: DLL problem on some machines

    I have compiled x86 and x64 versions of the software, and tried it in both 32 and 64-bit machines.

    The 32bit version run on a both 32 and 64 bit windows will "Stop working", and the 64bit version run on a 64bit windows crashes with a cryptic error message on the same line.

    The 64bit version run on a 32bit won't even start, naturally.

  6. #6
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    Re: DLL problem on some machines

    And I'm using Framework 4.0 - installed on the machines. Actually the app starts ok, I can use some functions of it. But when I press a button that would make use of the DLL methods and objects, I get the crash.

  7. #7
    Join Date
    Mar 2001
    Posts
    2,366

    Re: DLL problem on some machines

    Also you may want to check the DLL on the target machine with DependencyWalker. Here is the link:

    http://www.dependencywalker.com/

    It will give you the names and the prototypes of the API calls as well as some other useful debugging information. See if #1 the funtions changed...possibly their names.
    ahoodin
    To keep the plot moving, that's why.

  8. #8
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    Re: DLL problem on some machines

    Yes, S_M_A's post mentioned that already, but again, I have 2 other applications that make use of the library and they work! As far as I know, there is no "app-specific" dll registering, so if they use it, everyone can.

    Running DLL Walker on the file, I get this message on my machine (where the app IS working)
    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
    No DLL files are marked with warning symbols, the application works fine.

    Running DLL Walker on an XP machine, I get a warning symbol for WER.DLL, yet the app works fine!!!

    Running DLL Walker on a Win7 machine, I got a warning symbol for IEShims.dll. I copied the file to ..\Windows\System32\ and the warning symbol disappeared, but the app still would not work.

    Needless to say I feel a bit frustrated. Perhaps I'm not reading the DLL Walker interface correctly...? What am I looking for in case there is a problem with my DLL?

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,309

    Re: DLL problem on some machines

    Code:
    try
    {
      DllClassObject Object1 = new DllClassObject(); // This causes the crash
    
      Object1.Methods(...);
    }
    catch( Exception ex )
    {
      MessageBox.Show( String.Format("Help me figure this out: {0}", ex.Message );
    }

  10. #10
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    Re: DLL problem on some machines

    I'm already doing that, and no exception gets caught =(
    The app just stops, a message shows with "The Application stopped working, Windows is trying to find a solution bla bla" and then it quits.

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

This is a CodeGuru survey question.


Featured


HTML5 Development Center