Passing arguments to C++ class library

G

Guest

My application is written in C# and I'd like to pass 'double' array to managed C++ class library (which is a native C++ wrapper)
Of course the array should be passed by reference and not by value, therefore the C++ prototype is something like that
Void myFunc(double * myData

Since C# doesn't support pointer (in safe mode), I'm not sure what's the way for passing array of double ?
Maybe I have to change the C++ prototype for other arguments - I don't know!!

Any help would be much appreciated
 
M

Mattias Sjögren

Maybe I have to change the C++ prototype for other arguments - I don't know!!.

If that's an option, yes. Change the signature to something like

void foo(double arg __gc[])

and it should appear as an array in the C# code.



Mattias
 
G

Guest

Thanks a lot Mattias, that would be great only if I could obtain arg address. (I need it for farther use as an argument to memcpy which takes void* )
If you could help me with that, it would be very helpfu

Thanks again
 
S

Sagiv Philipp

Thanks a lot Mattias, that would be great only if I could obtain arg
address. (I need it for farther use in this particular method) - if you
have any idea for that, it would be very helpful.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top