Hi again,

I made a note a while ago about a potential bug that would occur if my app
installed to a device that didn't have gx.dll in the \Windows directory.

The recommendation seemed to be that if I'm using the GAPI (which I am) that
I should include gx.dll with my distribution and store it in the same folder
as my application. (See the end of this post for reference info).

So, my question is, if gx.dll isn't included on the device in \Windows, does
my app need to manually handle that case and dynamically load gx.dll, or does
the O/S automatically do something like:

1) Load app and sees that it requires gx.dll
2) Checks \Windows folder for gx.dll
3) If gx.dll isn't found in \Windows, check application's folder for gx.dll
4) If found, load the gx.dll found within the application folder

Or am I just supposed to always statically/dynamically link to my own copy
of gx.dll and assume that it won't be in the Windows directory? The above
makes sense to me, but I'm not sure if that's what happens, since it seems a
little hand-wavy.

I tried to delete gx.dll from the emulator to test this out but WM wouldn't
have it.

Here's one of the quotes I wrote down. I have two others, but I didn't save
their links for some reason:

"On PocketPCs and Smartphones, a specific library called "gx.dll" needs to
be placed in the \Windows folder or the application folder of your program.
Newer devices have this DLL built in, but some older devices does not. If the
file gx.dll is not available CGapiDisplay::OpenDisplay will return
GDERR_NOGAPI. The file gx.dll is included in the GapiDraw SDK in the "misc"
folder. It is recommended that you always ship gx.dll with your application."

Reference:
http://www.develant.com/docs/gapidraw/36/gapidisplay-main.htm

Would anyone happen to know what goes on behind the scenes (or at least what
Microsoft expects us to do) in the case of a missing gx.dll?

Thank you,
Chris Writely

Re: Do we *need to* dynamically link gx.dll? by Christopher

Christopher
Wed Feb 27 22:42:21 CST 2008

Hi,

"Chris Writely" <ChrisWritely@discussions.microsoft.com> wrote in message
news:66BACD89-C898-4989-97B4-52DDD9AA2280@microsoft.com...
>or does the O/S automatically do something like:
>
> 1) Load app and sees that it requires gx.dll
> 2) Checks \Windows folder for gx.dll
> 3) If gx.dll isn't found in \Windows, check application's folder for
> gx.dll
> 4) If found, load the gx.dll found within the application folder

Yes the loader does something a little bit like this, except the ordering is
slightly different. For example it will detect the version found in your
application folder before the one within the windows directory, and it's a
little more complicated if a module with the same name has already been
loaded into the process etc.

> Would anyone happen to know what goes on behind the scenes (or at least
> what
> Microsoft expects us to do) in the case of a missing gx.dll?

According to the Designed for Windows Mobile logo certification guidelines
(http://download.microsoft.com/download/8/d/1/8d1e9ac8-4a05-4480-8c91-3b83f74cd630/Designed%20for%20PPC_Handbook_Oct2006.pdf)

"Any .DLL files used in the installation of the application on the Windows
Mobile-based Pocket PC platform should only store "shared" files/DLLs in the
Windows directory, and every other file in the application's own directory
(which may be modified by the end user).

Additionally, if the application installs GX.dll (GAPI), it must install
that DLL in the application directory, not the Windows directory.
Applications that use GAPI must install this DLL."

So I would take that to mean Microsoft recommends

A) always distributing GAPI with your application CAB file
B) you should install it into your application folder and not \windows.

At least this is what would be required in order to use the "Designed for
Windows Mobile" logo for your application, which theoretically is a sign of
applications that meet certain implementation standards.

This will mean your app uses the version of GAPI installed by your app and
not the version that may be present on the device already.

Hope this helps,
Christopher Fairbairn


Re: Do we *need to* dynamically link gx.dll? by ChrisWritely

ChrisWritely
Wed Feb 27 23:17:01 CST 2008

"Christopher Fairbairn" wrote:

> Hi,
>
> Yes the loader does something a little bit like this, except the ordering is
> slightly different. For example it will detect the version found in your
> application folder before the one within the windows directory, and it's a
> little more complicated if a module with the same name has already been
> loaded into the process etc.

Thanks for the clarification on this. I was hoping to get the details on
what's done in the background. :)

> So I would take that to mean Microsoft recommends
>
> A) always distributing GAPI with your application CAB file
> B) you should install it into your application folder and not \windows.
>

Makes sense. But another question then: What do you/Microsoft mean when you
say "install"? Does this just mean to basically store the file in the same
folder as my application? Or do I need to register it somehow with the O/S?

(The "Designed For Windows Mobile" info was actually one of the other quotes
I wrote down... I wasn't quite sure what they meant by "install" when I read
it.)

Thanks again,
Chris Writely


> Hope this helps,
> Christopher Fairbairn
>

Re: Do we *need to* dynamically link gx.dll? by Christopher

Christopher
Thu Feb 28 16:01:32 CST 2008

Hi,

> Thanks for the clarification on this. I was hoping to get the details on
> what's done in the background. :)

You can get a pretty good overview of the process from the documentation for
the LoadLibrary API. This is available on MSDN at
http://msdn2.microsoft.com/en-us/library/ms886736.aspx.

See for example the list near the bottom of the article.

> Makes sense. But another question then: What do you/Microsoft mean when
> you
> say "install"? Does this just mean to basically store the file in the same
> folder as my application? Or do I need to register it somehow with the
> O/S?

I take "install" in this case to mean simply placing the DLL in the
application folder. As far as I am aware there is no additional registration
or installation process required.

Hope this helps,
Christopher Fairbairn


Re: Do we *need to* dynamically link gx.dll? by ChrisWritely

ChrisWritely
Fri Feb 29 14:16:06 CST 2008

"Christopher Fairbairn" wrote:
>
> You can get a pretty good overview of the process from the documentation for
> the LoadLibrary API. This is available on MSDN at
> http://msdn2.microsoft.com/en-us/library/ms886736.aspx.
>
> See for example the list near the bottom of the article.

Thanks for the link, Christopher. I was wondering if there was some secret
book that I didn't know about or something... I should have figured it'd be
on MSDN. :)

>
> I take "install" in this case to mean simply placing the DLL in the
> application folder. As far as I am aware there is no additional registration
> or installation process required.
>

That's good to hear, I really didn't want to have to force linking to gx.dll
for this. It seemed kind of unnecessary.

Thanks again,
Chris Writely