|
|
|
start date: Tue, 24 Jul 2007 06:15:55 +0300,
posted on: microsoft.public.dotnet.framework.compactframework
back
| Thread Index |
|
1
Empi
|
|
2
ctacke/ ctacke[at]opennetcf[dot]com
|
|
3
Empi
|
|
4
Paul G. Tobey [eMVP] p space tobey no spam AT no instrument no spam DOT com
|
coredll.dll ReadFile
Hi,
is [DllImport("coredll.dll", EntryPoint="ReadFile")] managed or not ?
If not, how come I find no sample that relate to the byte[] array
with marshal unmanaged to avoid memory buffer mismatch (none sequential
memory area) ?
Thanks.
Date:Tue, 24 Jul 2007 06:15:55 +0300
Author:
|
Re: coredll.dll ReadFile
I don't understand the question. It's clearly C#, which by definition is
managed code. Nearly all samples for it I would expect to use a byte[]
parameter for the lpBuffer parameter, but I don't know what you mean by
"marshal unmanaged" or "avoid memory mismatch". Do you mean avoiding a
pointer invalidation due to a GC compaction? ReadFile is synchronous, so
once your thread goes into the call, compaction can't occur until you return
from it, so there's nothing inherently unsafe about the operation and
pinning the inbound array isn't necessary (though pre-allocation is).
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
"Empi" wrote in message
news:ej0oyDazHHA.5992@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> is [DllImport("coredll.dll", EntryPoint="ReadFile")] managed or not ?
> If not, how come I find no sample that relate to the byte[] array
> with marshal unmanaged to avoid memory buffer mismatch (none sequential
> memory area) ?
>
>
> Thanks.
>
>
>
>
Date:Mon, 23 Jul 2007 22:22:41 -0500
Author:
|
Re: coredll.dll ReadFile
Thanks.
I didn't know if coredll.dll has it all managed or further depends on
unmanaged api's.
"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:eyMJOIazHHA.1168@TK2MSFTNGP02.phx.gbl...
>I don't understand the question. It's clearly C#, which by definition is
>managed code. Nearly all samples for it I would expect to use a byte[]
>parameter for the lpBuffer parameter, but I don't know what you mean by
>"marshal unmanaged" or "avoid memory mismatch". Do you mean avoiding a
>pointer invalidation due to a GC compaction? ReadFile is synchronous, so
>once your thread goes into the call, compaction can't occur until you
>return from it, so there's nothing inherently unsafe about the operation
>and pinning the inbound array isn't necessary (though pre-allocation is).
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Managed Code in an Embedded World
> www.OpenNETCF.com
>
>
>
>
> "Empi" wrote in message
> news:ej0oyDazHHA.5992@TK2MSFTNGP02.phx.gbl...
>> Hi,
>>
>> is [DllImport("coredll.dll", EntryPoint="ReadFile")] managed or not ?
>> If not, how come I find no sample that relate to the byte[] array
>> with marshal unmanaged to avoid memory buffer mismatch (none sequential
>> memory area) ?
>>
>>
>> Thanks.
>>
>>
>>
>>
>
>
Date:Tue, 24 Jul 2007 06:55:46 +0300
Author:
|
Re: coredll.dll ReadFile
Coredll itself, the DLL, is native code, not managed. You're platform
invoking, P/Invoking, that call, which is the same call that a native C
program running on the device would access if it were reading from a file.
Paul T.
"Empi" wrote in message
news:eUr9DaazHHA.600@TK2MSFTNGP05.phx.gbl...
> Thanks.
>
> I didn't know if coredll.dll has it all managed or further depends on
> unmanaged api's.
>
>
> "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
> news:eyMJOIazHHA.1168@TK2MSFTNGP02.phx.gbl...
>>I don't understand the question. It's clearly C#, which by definition is
>>managed code. Nearly all samples for it I would expect to use a byte[]
>>parameter for the lpBuffer parameter, but I don't know what you mean by
>>"marshal unmanaged" or "avoid memory mismatch". Do you mean avoiding a
>>pointer invalidation due to a GC compaction? ReadFile is synchronous, so
>>once your thread goes into the call, compaction can't occur until you
>>return from it, so there's nothing inherently unsafe about the operation
>>and pinning the inbound array isn't necessary (though pre-allocation is).
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Managed Code in an Embedded World
>> www.OpenNETCF.com
>>
>>
>>
>>
>> "Empi" wrote in message
>> news:ej0oyDazHHA.5992@TK2MSFTNGP02.phx.gbl...
>>> Hi,
>>>
>>> is [DllImport("coredll.dll", EntryPoint="ReadFile")] managed or not ?
>>> If not, how come I find no sample that relate to the byte[] array
>>> with marshal unmanaged to avoid memory buffer mismatch (none sequential
>>> memory area) ?
>>>
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>
>>
>
>
Date:Tue, 24 Jul 2007 08:11:22 -0700
Author:
|
|
|