Click here to Skip to main content
15,888,802 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataBindingComplete on ComboBox? Pin
_Erik_19-Jan-11 5:58
_Erik_19-Jan-11 5:58 
AnswerRe: DataBindingComplete on ComboBox? Pin
MumbleB19-Jan-11 6:24
MumbleB19-Jan-11 6:24 
GeneralRe: DataBindingComplete on ComboBox? Pin
Dewald19-Jan-11 20:40
Dewald19-Jan-11 20:40 
Questionhow should i word this... and better...how should i do it? Pin
jwalker34318-Jan-11 17:01
jwalker34318-Jan-11 17:01 
AnswerRe: how should i word this... and better...how should i do it? Pin
PIEBALDconsult18-Jan-11 18:19
mvePIEBALDconsult18-Jan-11 18:19 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 1:59
jwalker34319-Jan-11 1:59 
AnswerRe: how should i word this... and better...how should i do it? Pin
#realJSOP18-Jan-11 23:47
mve#realJSOP18-Jan-11 23:47 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 2:05
jwalker34319-Jan-11 2:05 
GeneralRe: how should i word this... and better...how should i do it? Pin
#realJSOP19-Jan-11 2:10
mve#realJSOP19-Jan-11 2:10 
GeneralRe: how should i word this... and better...how should i do it? Pin
DaveyM6919-Jan-11 2:48
professionalDaveyM6919-Jan-11 2:48 
GeneralRe: how should i word this... and better...how should i do it? Pin
#realJSOP19-Jan-11 2:52
mve#realJSOP19-Jan-11 2:52 
GeneralRe: how should i word this... and better...how should i do it? Pin
jwalker34319-Jan-11 16:37
jwalker34319-Jan-11 16:37 
QuestionHow to pin List<byte[]> to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 2:09
professionalChesnokov Yuriy18-Jan-11 2:09 
AnswerRe: How to pin List<byte[]> to unmanaged byte** Pin
Ravi Sant18-Jan-11 2:26
Ravi Sant18-Jan-11 2:26 
AnswerRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 2:35
professionalChesnokov Yuriy18-Jan-11 2:35 
AnswerRe: How to pin List<byte[]> to unmanaged byte** Pin
_Erik_18-Jan-11 2:37
_Erik_18-Jan-11 2:37 
GeneralRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 2:48
professionalChesnokov Yuriy18-Jan-11 2:48 
GeneralRe: How to pin List to unmanaged byte** Pin
DaveyM6918-Jan-11 2:57
professionalDaveyM6918-Jan-11 2:57 
QuestionRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 3:03
professionalChesnokov Yuriy18-Jan-11 3:03 
GeneralRe: How to pin List to unmanaged byte** Pin
_Erik_18-Jan-11 3:01
_Erik_18-Jan-11 3:01 
AnswerRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 3:06
professionalChesnokov Yuriy18-Jan-11 3:06 
GeneralRe: How to pin List to unmanaged byte** Pin
_Erik_18-Jan-11 3:17
_Erik_18-Jan-11 3:17 
AnswerRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 3:20
professionalChesnokov Yuriy18-Jan-11 3:20 
GeneralRe: How to pin List to unmanaged byte** Pin
_Erik_18-Jan-11 3:47
_Erik_18-Jan-11 3:47 
Ok. Let's see.

Chesnokov Yuriy wrote:
It is not possible to pass managed byte[][] to unmanaged byte**.

This possibility depends on how you import the unmanaged function. When using P/Invoke the parameters in the managed version just need to have the same size of the target unmanaged version. Since byte** is a pointer, and byte[][] is a reference, both of them have the same size becouse both of them are pointers.

Chesnokov Yuriy wrote:
Even if it was possible managed memory is not fixed.

Yes, that's right, but when you make a P/Invoke call, the CLR automatically pins the references passed to the unmanaged function into the managed heap, so the references will not move until the call is finished so, if you use references (such as byte[]), there is no need to manually pin them.

Chesnokov Yuriy wrote:
I have List and I need to pass it to byte**.

Try importing the unmanaged function as I told you before, I mean, use byte[][] and not byte** as the type for the first parameter. Belive me, this is the easiest way, it's worth to try. We can try the tricky version later if this does not work.

Chesnokov Yuriy wrote:
byte[][] conversion is out of scope as arrays may be of different size.

And casting to byte** is a warranty for that?

Chesnokov Yuriy wrote:
It needs to allocate with static alloc array to hold pinned pointers. Then to pin them.

To pin references into the managed heap you have to use GCHandle struct.
GeneralRe: How to pin List to unmanaged byte** Pin
Chesnokov Yuriy18-Jan-11 8:07
professionalChesnokov Yuriy18-Jan-11 8:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.