Having trouble with LoadLibrary

Having trouble with LoadLibrary

Post by Gordon Scot » Sun, 13 Jul 2003 07:44:03



I'm hoping somebody can give me pointers on where track down a problem I am
having.

I am using LoadLibrary() to load a dll into my application.  The dll is
about 100K in size.
When running I have around 10 megs free of both storage space and program
space.

When trying to load the dll, occasionally the dll will fail to load,
retruning NULL for the handle,
and GetLastError() returns error code 14, which is OUT_OF_MEMORY, which
obviously is not the case.

Anyone got any ideas?  I can't place any debug statements in the dll because
it is failing to load, never even calls the DllMain() routine.

Gordon

 
 
 

Having trouble with LoadLibrary

Post by Maarten Struy » Sun, 13 Jul 2003 15:34:40


There is an issue specifically with DLL's. The explanation for it is sort of
large and detailed, but Doug Boling has written a very clear article about
this: http://msdn.microsoft.com/library/en-us/dncenet/html/advmemmgmt.asp.
Hopefully it is of use for you.

--
Regards,

Maarten Struys
PTS Software bv
----

Quote:> I'm hoping somebody can give me pointers on where track down a problem I
am
> having.

> I am using LoadLibrary() to load a dll into my application.  The dll is
> about 100K in size.
> When running I have around 10 megs free of both storage space and program
> space.

> When trying to load the dll, occasionally the dll will fail to load,
> retruning NULL for the handle,
> and GetLastError() returns error code 14, which is OUT_OF_MEMORY, which
> obviously is not the case.

> Anyone got any ideas?  I can't place any debug statements in the dll
because
> it is failing to load, never even calls the DllMain() routine.

> Gordon


 
 
 

Having trouble with LoadLibrary

Post by Maarten Struy » Sun, 13 Jul 2003 15:37:14


Early in the morning I should choose my words better. It is not really an
issue, but more the way memory management works in CE devices.

--
Regards,

Maarten Struys
PTS Software bv
----

Quote:> I'm hoping somebody can give me pointers on where track down a problem I
am
> having.

> I am using LoadLibrary() to load a dll into my application.  The dll is
> about 100K in size.
> When running I have around 10 megs free of both storage space and program
> space.

> When trying to load the dll, occasionally the dll will fail to load,
> retruning NULL for the handle,
> and GetLastError() returns error code 14, which is OUT_OF_MEMORY, which
> obviously is not the case.

> Anyone got any ideas?  I can't place any debug statements in the dll
because
> it is failing to load, never even calls the DllMain() routine.

> Gordon

 
 
 

Having trouble with LoadLibrary

Post by Gordon Scot » Wed, 16 Jul 2003 00:03:23


Wow,

Thanks a bunch Maarten.  I actually had a work around in which I was loading
my dll's on app startup which seemed to alleviate the problem, but I did not
know why.
I had two dll's that were being sporadic, but I was loading those two dll's
after a larger dll that was using htmlview.lib.  Loading those first worked.
Looks like I'll be needing
to modify my application however to reduce the number of dlls.


> There is an issue specifically with DLL's. The explanation for it is sort
of
> large and detailed, but Doug Boling has written a very clear article about
> this: http://msdn.microsoft.com/library/en-us/dncenet/html/advmemmgmt.asp.
> Hopefully it is of use for you.

> --
> Regards,

> Maarten Struys
> PTS Software bv
> ----


> > I'm hoping somebody can give me pointers on where track down a problem I
> am
> > having.

> > I am using LoadLibrary() to load a dll into my application.  The dll is
> > about 100K in size.
> > When running I have around 10 megs free of both storage space and
program
> > space.

> > When trying to load the dll, occasionally the dll will fail to load,
> > retruning NULL for the handle,
> > and GetLastError() returns error code 14, which is OUT_OF_MEMORY, which
> > obviously is not the case.

> > Anyone got any ideas?  I can't place any debug statements in the dll
> because
> > it is failing to load, never even calls the DllMain() routine.

> > Gordon