Welcome to MSDN Blogs Sign in | Join | Help

MelSam's Blog

Mel Sampat on Windows Mobile
Cool realization: Depends.exe works well with WM apps!

Remember that cool developer tool Dependency Walker that shows you which .dlls a given .exe depends on? It's invaluable for debugging and packaging purposes and it's free! I've used this tool for years as a desktop Windows developer. Turns out that it works even for Windows Mobile .exes and .dlls. Simply copy an executable file (.exe, .dll, .ocx etc) from your device to the desktop and load it up in Dependency Walker. The tool will show you all the dependencies, even if the executable was compiled for an ARM device. That is sweet!

Since you run this tool on the desktop, naturally there will be device files that are not present. These will still be listed in Dependency Walker which is very handy.

Depends.exe Screenshot

The other day I was having trouble with an app that just wouldn't load up on a specific Pocket PC device running Windows Mobile 5. It would load on all other WM5 devices, just not this one. After wasting a frustrating hour troubleshooting, I decided to view it in Depends.exe just for kicks. And that helped me notice the problem right away! As you can see above, this app depends on Phone.dll, which exists only on devices running WM5 Pocket PC Phone Edition. The one device I was testing on was not a phone. Thus the missing phone.dll was preventing this app from starting up.

Lesson 1: if you're linking an application against OS dll's like phone.dll and expect it to work on all devices, prefer explicit linking over implicit linking.

Lesson 2: use Dependency Walker to diagnose hard to detect issues and verify your application's dependencies when creating .cab installers.

-Mel

Posted: Sunday, September 17, 2006 10:11 PM by MelSam

Comments

Julian Rayner said:

What if the Error opening file... DLL's above call other dll's/are dependent on other dll's.  Since it can't find these files, depends can't actually work out all the files needed for an app to run, only the first level of files directly called in the exe.

# February 12, 2007 7:57 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker