Click here to Skip to main content
15,908,172 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: Multiple forms problem C++ / CLI Pin
Andreoli Carlo3-Jun-10 22:35
professionalAndreoli Carlo3-Jun-10 22:35 
GeneralRe: Multiple forms problem C++ / CLI Pin
Piotrekneo184-Jun-10 3:59
Piotrekneo184-Jun-10 3:59 
QuestionBatch Help: Delete Oldest File Pin
See_Sharp28-May-10 10:56
See_Sharp28-May-10 10:56 
AnswerRe: Batch Help: Delete Oldest File Pin
Luc Pattyn28-May-10 11:32
sitebuilderLuc Pattyn28-May-10 11:32 
GeneralRe: Batch Help: Delete Oldest File Pin
See_Sharp31-May-10 4:52
See_Sharp31-May-10 4:52 
GeneralRe: Batch Help: Delete Oldest File Pin
Luc Pattyn31-May-10 5:04
sitebuilderLuc Pattyn31-May-10 5:04 
QuestionHow do I make a managed c++ struct that will be usable in c# as an array, while still being able to be passed to unmanaged c++ as an array? Pin
544d4e27-May-10 7:42
544d4e27-May-10 7:42 
AnswerRe: How do I make a managed c++ struct that will be usable in c# as an array, while still being able to be passed to unmanaged c++ as an array? [modified] Pin
Paul Michalik3-Jun-10 2:35
Paul Michalik3-Jun-10 2:35 
You will need a "managed" equivalent of both (or at least the second one):
1. native TimePosition and
2. native array of TimePosition instances

If the mgdDataProducer sees struct TimedPosition while compiling in /clr mode, the 1st one is not necessary, I think. I am assuming here that void GetData( TimedPosition * tp, unsigned int count ) should fill an c-style array with "count" TimedPosition instances, right?

The signature of managed "GetData" would be then:

C++/CLI:
void mgdDataProducer::GetData(array<TimedPosition>^ Data, unsigned& Count);

C#:
void GetData(TimedPosition[] Data, ref uint Count);


In your implementation of mgdDataProducer::GetData, you need to transfer the content of native c++ array to a managed array (collection.. whatever). There exist several possibilities to accomplish this, I bet there are some built in interoperability helpers for transfering all native c-like or std:: sequences, although I cannot find a direct link right now.

The simplest way is to call the unmanaged DataProducer with a local c-style array, and shuffle the (there created) TimedPosition instances into the managed array. You can also write reusable wrappers for unmanaged arrays and much more, look at the keywords cli interop, marshalling or similar. I would also try to avoid PInvoke or unsafe stuff...

Cheers,

Paul

modified on Thursday, June 3, 2010 9:08 AM

QuestionSerialization problem Pin
roshihans20-May-10 21:05
roshihans20-May-10 21:05 
Questiona little help ,find a word from text Pin
Gilbertu19-May-10 10:43
Gilbertu19-May-10 10:43 
AnswerRe: a little help ,find a word from text Pin
Luc Pattyn19-May-10 14:05
sitebuilderLuc Pattyn19-May-10 14:05 
AnswerRe: a little help ,find a word from text Pin
T210215-Jun-10 21:26
T210215-Jun-10 21:26 
QuestionGet the button click event from another form Pin
rikterveen18-May-10 20:46
rikterveen18-May-10 20:46 
GeneralRe: Get the button click event from another form Pin
Andreoli Carlo18-May-10 21:56
professionalAndreoli Carlo18-May-10 21:56 
GeneralRe: Get the button click event from another form Pin
rikterveen20-May-10 7:16
rikterveen20-May-10 7:16 
AnswerRe: Get the button click event from another form [modified] Pin
Andreoli Carlo20-May-10 23:14
professionalAndreoli Carlo20-May-10 23:14 
GeneralRe: Get the button click event from another form Pin
rikterveen27-May-10 20:44
rikterveen27-May-10 20:44 
GeneralRe: Get the button click event from another form Pin
Andreoli Carlo31-May-10 12:01
professionalAndreoli Carlo31-May-10 12:01 
AnswerRe: Get the button click event from another form Pin
voo doo125-Jun-10 6:24
voo doo125-Jun-10 6:24 
Questionnot able to built project in release mode Pin
sharada veena17-May-10 19:26
sharada veena17-May-10 19:26 
Questionhelp vc++.net Pin
Gilbertu17-May-10 0:22
Gilbertu17-May-10 0:22 
AnswerRe: help vc++.net Pin
Richard MacCutchan17-May-10 1:26
mveRichard MacCutchan17-May-10 1:26 
Question[] symbol appears in string when reading from / writing to file Pin
KlaasVersteeg16-May-10 23:57
KlaasVersteeg16-May-10 23:57 
QuestionSizeof out of scope? Pin
Xpnctoc8-May-10 6:39
Xpnctoc8-May-10 6:39 
AnswerRe: Sizeof out of scope? Pin
Michel Godfroid8-May-10 8:48
Michel Godfroid8-May-10 8:48 

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.