|
|
|
start date: Tue, 24 Jul 2007 04:46:02 -0700,
posted on: microsoft.public.dotnet.framework.compactframework
back
| Thread Index |
|
1
Michal Rizek
|
|
2
Christian Resma Helle
|
|
3
Michal Rizek
|
|
4
Paul G. Tobey [eMVP] p space tobey no spam AT no instrument no spam DOT com
|
|
5
ctacke/ ctacke[at]opennetcf[dot]com
|
|
6
Paul G. Tobey [eMVP] p space tobey no spam AT no instrument no spam DOT com
|
|
7
ctacke/ ctacke[at]opennetcf[dot]com
|
|
8
ctacke/ ctacke[at]opennetcf[dot]com
|
|
9
Michal Rizek
|
|
10
ctacke/ ctacke[at]opennetcf[dot]com
|
Can't find PInvoke DLL - BUG?
Hi,
i have strange problem using PIvoke.
When i call function from native library i get "Can't find PInvoke DLL"
error sometimes.
The .dll is located in the same directory as app.
When i restart system, then it works fine.
It seems to like that os can't see or access library file on some
circumstances...
have anyone expirienced such behaviour?
Date:Tue, 24 Jul 2007 04:46:02 -0700
Author:
|
Re: Can't find PInvoke DLL - BUG?
Have you tried placing the DLL you want to P/Invoke in the \Windows folder?
How does your code look like?
--
Regards,
Christian Resma Helle
http://christian-helle.blogspot.com
"Michal Rizek" wrote in message
news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
> Hi,
> i have strange problem using PIvoke.
>
> When i call function from native library i get "Can't find PInvoke DLL"
> error sometimes.
> The .dll is located in the same directory as app.
> When i restart system, then it works fine.
>
> It seems to like that os can't see or access library file on some
> circumstances...
>
> have anyone expirienced such behaviour?
>
>
>
>
>
>
Date:Tue, 24 Jul 2007 13:58:14 +0200
Author:
|
Re: Can't find PInvoke DLL - BUG?
My code where i use method from zlibce.dll:
Error: "Can't find PInvoke DLL 'zlibce.dll'"
....
private static int Uncompress(byte[] dest, ref int destLen, byte[] src, int
srcLen)
{
if (Environment.OSVersion.Platform == PlatformID.WinCE)
return uncompressCE(dest, ref destLen, src, srcLen);
else
return uncompress(dest, ref destLen, src, srcLen);
}
#region zlib.dll
[DllImport("zlib1.dll")]
private static extern int compress(byte[] dest, ref int destLen, byte[] src,
int srcLen);
[DllImport("zlib1.dll")]
private static extern int uncompress(byte[] dest, ref int destLen, byte[]
src, int srcLen);
[DllImport("zlibce.dll", EntryPoint = "compress")]
private static extern int compressCE(byte[] dest, ref int destLen, byte[]
src, int srcLen);
[DllImport("zlibce.dll", EntryPoint = "uncompress")]
private static extern int uncompressCE(byte[] dest, ref int destLen, byte[]
src, int srcLen);
#endregion
....
I am getting same error when using another dll (my own) - the usage is quite
similat except that there is no platform switch (only for CE).
I did not tried to move dlls to \Windows jet - problem is, that this error
is very irregular - it happend only once on our testing environment, but it
happens more often to our customer.
Is there any difference when loading library from app. directory and from
\Windows directory?
"Christian Resma Helle" wrote:
> Have you tried placing the DLL you want to P/Invoke in the \Windows folder?
> How does your code look like?
>
> --
> Regards,
> Christian Resma Helle
> http://christian-helle.blogspot.com
>
>
> "Michal Rizek" wrote in message
> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
> > Hi,
> > i have strange problem using PIvoke.
> >
> > When i call function from native library i get "Can't find PInvoke DLL"
> > error sometimes.
> > The .dll is located in the same directory as app.
> > When i restart system, then it works fine.
> >
> > It seems to like that os can't see or access library file on some
> > circumstances...
> >
> > have anyone expirienced such behaviour?
> >
> >
> >
> >
> >
> >
>
>
>
Date:Tue, 24 Jul 2007 06:38:02 -0700
Author:
|
Re: Can't find PInvoke DLL - BUG?
I don't have a Windows Mobile device in front of me, but are you sure that
the DLL name is ZLIBCE.DLL? I think maybe ZLIB.DLL is more likely, as
that's what its name is in generic WindowsCE.
Paul T.
"Michal Rizek" wrote in message
news:2E1409BE-8DC2-4978-86F6-8BDD9444487C@microsoft.com...
> My code where i use method from zlibce.dll:
> Error: "Can't find PInvoke DLL 'zlibce.dll'"
>
> ...
>
> private static int Uncompress(byte[] dest, ref int destLen, byte[] src,
> int
> srcLen)
> {
> if (Environment.OSVersion.Platform == PlatformID.WinCE)
> return uncompressCE(dest, ref destLen, src, srcLen);
> else
> return uncompress(dest, ref destLen, src, srcLen);
> }
>
> #region zlib.dll
> [DllImport("zlib1.dll")]
> private static extern int compress(byte[] dest, ref int destLen, byte[]
> src,
> int srcLen);
>
> [DllImport("zlib1.dll")]
> private static extern int uncompress(byte[] dest, ref int destLen, byte[]
> src, int srcLen);
>
> [DllImport("zlibce.dll", EntryPoint = "compress")]
> private static extern int compressCE(byte[] dest, ref int destLen, byte[]
> src, int srcLen);
>
> [DllImport("zlibce.dll", EntryPoint = "uncompress")]
> private static extern int uncompressCE(byte[] dest, ref int destLen,
> byte[]
> src, int srcLen);
> #endregion
>
> ...
>
> I am getting same error when using another dll (my own) - the usage is
> quite
> similat except that there is no platform switch (only for CE).
>
> I did not tried to move dlls to \Windows jet - problem is, that this error
> is very irregular - it happend only once on our testing environment, but
> it
> happens more often to our customer.
>
> Is there any difference when loading library from app. directory and from
> \Windows directory?
>
>
> "Christian Resma Helle" wrote:
>
>> Have you tried placing the DLL you want to P/Invoke in the \Windows
>> folder?
>> How does your code look like?
>>
>> --
>> Regards,
>> Christian Resma Helle
>> http://christian-helle.blogspot.com
>>
>>
>> "Michal Rizek" wrote in message
>> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
>> > Hi,
>> > i have strange problem using PIvoke.
>> >
>> > When i call function from native library i get "Can't find PInvoke DLL"
>> > error sometimes.
>> > The .dll is located in the same directory as app.
>> > When i restart system, then it works fine.
>> >
>> > It seems to like that os can't see or access library file on some
>> > circumstances...
>> >
>> > have anyone expirienced such behaviour?
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
Date:Tue, 24 Jul 2007 08:13:29 -0700
Author:
|
Re: Can't find PInvoke DLL - BUG?
This can occur if you are out of virtual memory and the DLL cannot be
loaded.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Michal Rizek" wrote in message
news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
> Hi,
> i have strange problem using PIvoke.
>
> When i call function from native library i get "Can't find PInvoke DLL"
> error sometimes.
> The .dll is located in the same directory as app.
> When i restart system, then it works fine.
>
> It seems to like that os can't see or access library file on some
> circumstances...
>
> have anyone expirienced such behaviour?
>
>
>
>
>
>
Date:Tue, 24 Jul 2007 10:54:01 -0500
Author:
|
Re: Can't find PInvoke DLL - BUG?
It's definitely named correctly - we created it. :)
www.OpenNETCF.com/zlibce
-Chris
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:ePV2aUgzHHA.4928@TK2MSFTNGP03.phx.gbl...
>I don't have a Windows Mobile device in front of me, but are you sure that
>the DLL name is ZLIBCE.DLL? I think maybe ZLIB.DLL is more likely, as
>that's what its name is in generic WindowsCE.
>
> Paul T.
>
> "Michal Rizek" wrote in message
> news:2E1409BE-8DC2-4978-86F6-8BDD9444487C@microsoft.com...
>> My code where i use method from zlibce.dll:
>> Error: "Can't find PInvoke DLL 'zlibce.dll'"
>>
>> ...
>>
>> private static int Uncompress(byte[] dest, ref int destLen, byte[] src,
>> int
>> srcLen)
>> {
>> if (Environment.OSVersion.Platform == PlatformID.WinCE)
>> return uncompressCE(dest, ref destLen, src, srcLen);
>> else
>> return uncompress(dest, ref destLen, src, srcLen);
>> }
>>
>> #region zlib.dll
>> [DllImport("zlib1.dll")]
>> private static extern int compress(byte[] dest, ref int destLen, byte[]
>> src,
>> int srcLen);
>>
>> [DllImport("zlib1.dll")]
>> private static extern int uncompress(byte[] dest, ref int destLen, byte[]
>> src, int srcLen);
>>
>> [DllImport("zlibce.dll", EntryPoint = "compress")]
>> private static extern int compressCE(byte[] dest, ref int destLen, byte[]
>> src, int srcLen);
>>
>> [DllImport("zlibce.dll", EntryPoint = "uncompress")]
>> private static extern int uncompressCE(byte[] dest, ref int destLen,
>> byte[]
>> src, int srcLen);
>> #endregion
>>
>> ...
>>
>> I am getting same error when using another dll (my own) - the usage is
>> quite
>> similat except that there is no platform switch (only for CE).
>>
>> I did not tried to move dlls to \Windows jet - problem is, that this
>> error
>> is very irregular - it happend only once on our testing environment, but
>> it
>> happens more often to our customer.
>>
>> Is there any difference when loading library from app. directory and from
>> \Windows directory?
>>
>>
>> "Christian Resma Helle" wrote:
>>
>>> Have you tried placing the DLL you want to P/Invoke in the \Windows
>>> folder?
>>> How does your code look like?
>>>
>>> --
>>> Regards,
>>> Christian Resma Helle
>>> http://christian-helle.blogspot.com
>>>
>>>
>>> "Michal Rizek" wrote in message
>>> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
>>> > Hi,
>>> > i have strange problem using PIvoke.
>>> >
>>> > When i call function from native library i get "Can't find PInvoke
>>> > DLL"
>>> > error sometimes.
>>> > The .dll is located in the same directory as app.
>>> > When i restart system, then it works fine.
>>> >
>>> > It seems to like that os can't see or access library file on some
>>> > circumstances...
>>> >
>>> > have anyone expirienced such behaviour?
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>>
>>>
>>>
>
>
Date:Tue, 24 Jul 2007 11:01:55 -0500
Author:
|
Re: Can't find PInvoke DLL - BUG?
You might try forcing a load earlier in the applciation (manually call
LoadLibrary or make a P/Invoke call to it at startup). However if the
device (is this by chance a PPC Phone Edition?) has very little virtual
memory and the users have a lot of other stuff going that is eating up what
little there is, there's not much you can do short of asking them to close
other apps or doing it for them. I'd be inclined to at least try
broadcasting a WM_HIBERNATE on failure and trying again just to see if that
helps mitigate the issue.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Michal Rizek" wrote in message
news:2E1409BE-8DC2-4978-86F6-8BDD9444487C@microsoft.com...
> My code where i use method from zlibce.dll:
> Error: "Can't find PInvoke DLL 'zlibce.dll'"
>
> ...
>
> private static int Uncompress(byte[] dest, ref int destLen, byte[] src,
> int
> srcLen)
> {
> if (Environment.OSVersion.Platform == PlatformID.WinCE)
> return uncompressCE(dest, ref destLen, src, srcLen);
> else
> return uncompress(dest, ref destLen, src, srcLen);
> }
>
> #region zlib.dll
> [DllImport("zlib1.dll")]
> private static extern int compress(byte[] dest, ref int destLen, byte[]
> src,
> int srcLen);
>
> [DllImport("zlib1.dll")]
> private static extern int uncompress(byte[] dest, ref int destLen, byte[]
> src, int srcLen);
>
> [DllImport("zlibce.dll", EntryPoint = "compress")]
> private static extern int compressCE(byte[] dest, ref int destLen, byte[]
> src, int srcLen);
>
> [DllImport("zlibce.dll", EntryPoint = "uncompress")]
> private static extern int uncompressCE(byte[] dest, ref int destLen,
> byte[]
> src, int srcLen);
> #endregion
>
> ...
>
> I am getting same error when using another dll (my own) - the usage is
> quite
> similat except that there is no platform switch (only for CE).
>
> I did not tried to move dlls to \Windows jet - problem is, that this error
> is very irregular - it happend only once on our testing environment, but
> it
> happens more often to our customer.
>
> Is there any difference when loading library from app. directory and from
> \Windows directory?
>
>
> "Christian Resma Helle" wrote:
>
>> Have you tried placing the DLL you want to P/Invoke in the \Windows
>> folder?
>> How does your code look like?
>>
>> --
>> Regards,
>> Christian Resma Helle
>> http://christian-helle.blogspot.com
>>
>>
>> "Michal Rizek" wrote in message
>> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
>> > Hi,
>> > i have strange problem using PIvoke.
>> >
>> > When i call function from native library i get "Can't find PInvoke DLL"
>> > error sometimes.
>> > The .dll is located in the same directory as app.
>> > When i restart system, then it works fine.
>> >
>> > It seems to like that os can't see or access library file on some
>> > circumstances...
>> >
>> > have anyone expirienced such behaviour?
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
Date:Tue, 24 Jul 2007 11:04:44 -0500
Author:
|
Re: Can't find PInvoke DLL - BUG?
Cool. zlib.dll in Windows CE has the same function name in it, so I thought
maybe I had it...
Paul T.
"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:%2366RVwgzHHA.4928@TK2MSFTNGP03.phx.gbl...
> It's definitely named correctly - we created it. :)
>
> www.OpenNETCF.com/zlibce
>
> -Chris
>
>
>
> "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
> com> wrote in message news:ePV2aUgzHHA.4928@TK2MSFTNGP03.phx.gbl...
>>I don't have a Windows Mobile device in front of me, but are you sure that
>>the DLL name is ZLIBCE.DLL? I think maybe ZLIB.DLL is more likely, as
>>that's what its name is in generic WindowsCE.
>>
>> Paul T.
>>
>> "Michal Rizek" wrote in message
>> news:2E1409BE-8DC2-4978-86F6-8BDD9444487C@microsoft.com...
>>> My code where i use method from zlibce.dll:
>>> Error: "Can't find PInvoke DLL 'zlibce.dll'"
>>>
>>> ...
>>>
>>> private static int Uncompress(byte[] dest, ref int destLen, byte[] src,
>>> int
>>> srcLen)
>>> {
>>> if (Environment.OSVersion.Platform == PlatformID.WinCE)
>>> return uncompressCE(dest, ref destLen, src, srcLen);
>>> else
>>> return uncompress(dest, ref destLen, src, srcLen);
>>> }
>>>
>>> #region zlib.dll
>>> [DllImport("zlib1.dll")]
>>> private static extern int compress(byte[] dest, ref int destLen, byte[]
>>> src,
>>> int srcLen);
>>>
>>> [DllImport("zlib1.dll")]
>>> private static extern int uncompress(byte[] dest, ref int destLen,
>>> byte[]
>>> src, int srcLen);
>>>
>>> [DllImport("zlibce.dll", EntryPoint = "compress")]
>>> private static extern int compressCE(byte[] dest, ref int destLen,
>>> byte[]
>>> src, int srcLen);
>>>
>>> [DllImport("zlibce.dll", EntryPoint = "uncompress")]
>>> private static extern int uncompressCE(byte[] dest, ref int destLen,
>>> byte[]
>>> src, int srcLen);
>>> #endregion
>>>
>>> ...
>>>
>>> I am getting same error when using another dll (my own) - the usage is
>>> quite
>>> similat except that there is no platform switch (only for CE).
>>>
>>> I did not tried to move dlls to \Windows jet - problem is, that this
>>> error
>>> is very irregular - it happend only once on our testing environment, but
>>> it
>>> happens more often to our customer.
>>>
>>> Is there any difference when loading library from app. directory and
>>> from
>>> \Windows directory?
>>>
>>>
>>> "Christian Resma Helle" wrote:
>>>
>>>> Have you tried placing the DLL you want to P/Invoke in the \Windows
>>>> folder?
>>>> How does your code look like?
>>>>
>>>> --
>>>> Regards,
>>>> Christian Resma Helle
>>>> http://christian-helle.blogspot.com
>>>>
>>>>
>>>> "Michal Rizek" wrote in message
>>>> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
>>>> > Hi,
>>>> > i have strange problem using PIvoke.
>>>> >
>>>> > When i call function from native library i get "Can't find PInvoke
>>>> > DLL"
>>>> > error sometimes.
>>>> > The .dll is located in the same directory as app.
>>>> > When i restart system, then it works fine.
>>>> >
>>>> > It seems to like that os can't see or access library file on some
>>>> > circumstances...
>>>> >
>>>> > have anyone expirienced such behaviour?
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>>
>>>>
>>>>
>>
>>
>
>
Date:Tue, 24 Jul 2007 09:11:24 -0700
Author:
|
Re: Can't find PInvoke DLL - BUG?
It sounds interesting - it realy could be memory issue.
I will try to trace some memory usage stats and see what's up.
Thank you
"<ctacke/>" wrote:
> This can occur if you are out of virtual memory and the DLL cannot be
> loaded.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Managed Code in an Embedded World
> www.OpenNETCF.com
>
>
> "Michal Rizek" wrote in message
> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
> > Hi,
> > i have strange problem using PIvoke.
> >
> > When i call function from native library i get "Can't find PInvoke DLL"
> > error sometimes.
> > The .dll is located in the same directory as app.
> > When i restart system, then it works fine.
> >
> > It seems to like that os can't see or access library file on some
> > circumstances...
> >
> > have anyone expirienced such behaviour?
> >
> >
> >
> >
> >
> >
>
>
>
Date:Tue, 24 Jul 2007 09:32:02 -0700
Author:
|
Re: Can't find PInvoke DLL - BUG?
Yep, the zlib in CE however is a really old version (complete with the bugs
and security problems).
-Chris
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:eUm0x0gzHHA.4712@TK2MSFTNGP04.phx.gbl...
> Cool. zlib.dll in Windows CE has the same function name in it, so I
> thought maybe I had it...
>
> Paul T.
>
> "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
> news:%2366RVwgzHHA.4928@TK2MSFTNGP03.phx.gbl...
>> It's definitely named correctly - we created it. :)
>>
>> www.OpenNETCF.com/zlibce
>>
>> -Chris
>>
>>
>>
>> "Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
>> DOT com> wrote in message news:ePV2aUgzHHA.4928@TK2MSFTNGP03.phx.gbl...
>>>I don't have a Windows Mobile device in front of me, but are you sure
>>>that the DLL name is ZLIBCE.DLL? I think maybe ZLIB.DLL is more likely,
>>>as that's what its name is in generic WindowsCE.
>>>
>>> Paul T.
>>>
>>> "Michal Rizek" wrote in message
>>> news:2E1409BE-8DC2-4978-86F6-8BDD9444487C@microsoft.com...
>>>> My code where i use method from zlibce.dll:
>>>> Error: "Can't find PInvoke DLL 'zlibce.dll'"
>>>>
>>>> ...
>>>>
>>>> private static int Uncompress(byte[] dest, ref int destLen, byte[] src,
>>>> int
>>>> srcLen)
>>>> {
>>>> if (Environment.OSVersion.Platform == PlatformID.WinCE)
>>>> return uncompressCE(dest, ref destLen, src, srcLen);
>>>> else
>>>> return uncompress(dest, ref destLen, src, srcLen);
>>>> }
>>>>
>>>> #region zlib.dll
>>>> [DllImport("zlib1.dll")]
>>>> private static extern int compress(byte[] dest, ref int destLen, byte[]
>>>> src,
>>>> int srcLen);
>>>>
>>>> [DllImport("zlib1.dll")]
>>>> private static extern int uncompress(byte[] dest, ref int destLen,
>>>> byte[]
>>>> src, int srcLen);
>>>>
>>>> [DllImport("zlibce.dll", EntryPoint = "compress")]
>>>> private static extern int compressCE(byte[] dest, ref int destLen,
>>>> byte[]
>>>> src, int srcLen);
>>>>
>>>> [DllImport("zlibce.dll", EntryPoint = "uncompress")]
>>>> private static extern int uncompressCE(byte[] dest, ref int destLen,
>>>> byte[]
>>>> src, int srcLen);
>>>> #endregion
>>>>
>>>> ...
>>>>
>>>> I am getting same error when using another dll (my own) - the usage is
>>>> quite
>>>> similat except that there is no platform switch (only for CE).
>>>>
>>>> I did not tried to move dlls to \Windows jet - problem is, that this
>>>> error
>>>> is very irregular - it happend only once on our testing environment,
>>>> but it
>>>> happens more often to our customer.
>>>>
>>>> Is there any difference when loading library from app. directory and
>>>> from
>>>> \Windows directory?
>>>>
>>>>
>>>> "Christian Resma Helle" wrote:
>>>>
>>>>> Have you tried placing the DLL you want to P/Invoke in the \Windows
>>>>> folder?
>>>>> How does your code look like?
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Christian Resma Helle
>>>>> http://christian-helle.blogspot.com
>>>>>
>>>>>
>>>>> "Michal Rizek" wrote in
>>>>> message
>>>>> news:75737F11-8E22-4F00-B1EB-620D0C9289EC@microsoft.com...
>>>>> > Hi,
>>>>> > i have strange problem using PIvoke.
>>>>> >
>>>>> > When i call function from native library i get "Can't find PInvoke
>>>>> > DLL"
>>>>> > error sometimes.
>>>>> > The .dll is located in the same directory as app.
>>>>> > When i restart system, then it works fine.
>>>>> >
>>>>> > It seems to like that os can't see or access library file on some
>>>>> > circumstances...
>>>>> >
>>>>> > have anyone expirienced such behaviour?
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>
Date:Tue, 24 Jul 2007 11:46:26 -0500
Author:
|
|
|