Click here to Skip to main content
15,909,205 members
Home / Discussions / C#
   

C#

 
QuestionLane Detection Algorithm Pin
sebogawa7-May-09 6:08
sebogawa7-May-09 6:08 
AnswerRe: Lane Detection Algorithm Pin
Luc Pattyn7-May-09 6:21
sitebuilderLuc Pattyn7-May-09 6:21 
GeneralRe: Lane Detection Algorithm Pin
sebogawa7-May-09 6:26
sebogawa7-May-09 6:26 
GeneralRe: Lane Detection Algorithm Pin
Luc Pattyn7-May-09 6:48
sitebuilderLuc Pattyn7-May-09 6:48 
QuestionReturn int* to C# from C++ DLL? Pin
Alan Balkany7-May-09 5:35
Alan Balkany7-May-09 5:35 
AnswerRe: Return int* to C# from C++ DLL? Pin
Luc Pattyn7-May-09 6:16
sitebuilderLuc Pattyn7-May-09 6:16 
GeneralRe: Return int* to C# from C++ DLL? Pin
Alan Balkany7-May-09 6:22
Alan Balkany7-May-09 6:22 
GeneralRe: Return int* to C# from C++ DLL? [modified] Pin
Luc Pattyn7-May-09 6:54
sitebuilderLuc Pattyn7-May-09 6:54 
Alan,

if lots of ints need to go to the managed world, a Marshal method call per int obviously is a bad idea.
[ADDED] Marshal.Copy would then be the obvious choice. [/ADDED]

However the best performance is achieved by:
- allocating a managed array
- getting its pointer (use GCHandle class)
- passing it to the native world so it gets filled
- when native is done, unpin and enjoy.

That way marshaling is completely free, no data got ever copied.

If the array size is not known beforehand, I either allocate it way too large, or split the native code in two functions, one that returns the required size, and one that fills the array.
[ADDED] It is also possible to provide a delegate so the native world can call it to get the array once the size is known [/ADDED]

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


modified on Thursday, May 7, 2009 1:10 PM

GeneralRe: Return int* to C# from C++ DLL? [modified] Pin
Alan Balkany7-May-09 8:27
Alan Balkany7-May-09 8:27 
GeneralRe: Return int* to C# from C++ DLL? Pin
Luc Pattyn7-May-09 8:38
sitebuilderLuc Pattyn7-May-09 8:38 
GeneralRe: Return int* to C# from C++ DLL? Pin
Dan Neely7-May-09 9:29
Dan Neely7-May-09 9:29 
GeneralRe: Return int* to C# from C++ DLL? Pin
Luc Pattyn7-May-09 9:54
sitebuilderLuc Pattyn7-May-09 9:54 
QuestionProblem in Toolstrip Pin
priyamtheone7-May-09 5:24
priyamtheone7-May-09 5:24 
QuestionUpdating confirmation box by commandfield. Pin
magshine7-May-09 5:15
magshine7-May-09 5:15 
QuestionHow to put powerpoint on different displays (multiply monitors)? Pin
molda7-May-09 5:06
molda7-May-09 5:06 
AnswerRe: How to put powerpoint on different displays (multiply monitors)? Pin
OriginalGriff7-May-09 5:11
mveOriginalGriff7-May-09 5:11 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
OriginalGriff7-May-09 5:46
mveOriginalGriff7-May-09 5:46 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
molda7-May-09 6:17
molda7-May-09 6:17 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
Luc Pattyn7-May-09 7:18
sitebuilderLuc Pattyn7-May-09 7:18 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
OriginalGriff7-May-09 8:19
mveOriginalGriff7-May-09 8:19 
AnswerRe: How to put powerpoint on different displays (multiply monitors)? Pin
Luc Pattyn7-May-09 7:17
sitebuilderLuc Pattyn7-May-09 7:17 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
molda7-May-09 21:40
molda7-May-09 21:40 
GeneralRe: How to put powerpoint on different displays (multiply monitors)? Pin
Luc Pattyn8-May-09 0:40
sitebuilderLuc Pattyn8-May-09 0:40 
QuestionPlease help with NHibernate. Could not compile the mapping document. Pin
Nopo7-May-09 4:45
Nopo7-May-09 4:45 
QuestionWatermarking over Video Pin
anki1237-May-09 3:19
anki1237-May-09 3:19 

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.