Minimize

Blog Entries

Problem with new Desktop Icon Protocol

May 12

Written by:
5/12/2011 12:00 AM  RssIcon

Here’s a problem we just figured out today. Implementing the new Sage ERP Accpac desktop Icon protocol requires that you provide a DLL with three entry points that get called when the desktop initializes.

We had all sorts of trouble getting the System Manager to load and run our DLL. We messed around with different ways to export the entry points, we implemented the DLL in a pure C environment (instead of a C++ file) and we moved the code into our activation view and exposed it there. None of it would work. So, we built a completely stand alone file and erected the basic protocol with nothing else. Presto! The DLL loaded and ran.

Cool, we didn’t really understand why, but what the hell it works. We then started adding real code to make the code do something.

Uh Oh…it’s broken again. What did we do? Well, we added calls to a dependency. Another DLL that has some support code. Why would that break it?

It turns out that when the Icon Protocol DLL is called, the working directory is NOT the module directory, it is RUNTIME. Therefore, if there is a dependency, the loader can’t find it and the load fails.

So, the rule of thumb is to not have any dependency DLL’s in your Icon Protocol DLL. If you do, you have to explicitly LoadLibrary and GetProcAddress to find the functions. Otherwise your DLL will not load.

Hope that helps!


Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment   Cancel 
Minimize

Search

Minimize

Recent Entries

How we built Murphy's booking system
Murphy's web store goes Live
Problem with new Desktop Icon Protocol
Debugging .NET Accpac Addons
Registrationless COM
Moving from MS to Open Source
CEAB UBC Visit
Board of Examiners Christmas Lunch
Sage ERP Accpac 5.6 has been released
DEP, .NET, Windows and Accpac