0

I'm trying to write a dll in c++ (under CLR/Class Library) to be added as a reference in a vb.net project. I explain the issue I have: when I write a generic function without using array or pointers I can visualize and use this function once I have build my c++ project and added as a reference the resulting dll to my vb.net project. But, when I try to write a function in which I have to use a multidimensional array, in the methods shown in the 'objects viewer' in vb my new function does not exists.

Is there something I should know in particular to use multidimensional array as a parameter in functions, to be visible when I add as a reference my dll? Or maybe there is complete different way I have to follow?

Please, let me know how can I resolve this problem.

Thanks for any help you could give me!!

Daniel_J
  • 1
  • 1

1 Answers1

0

One solution, using a C++/CLI DLL as a mediator. C++/CLI can deal with both native and managed types. So you can first passed the natvie multidimensional array as a parameter to C++/CLI, then in the C++/CLI Dll, you can creat a managed multidimensional array, and assign the values of the native one to the managed one. Finally, this managed one can be passed to VB.NET.

I used to use this solution to pass the multidimensional array from C to C#, I tried to find a better solution at that time, but I didn't. I hope there will be now.

Matt
  • 6,010
  • 25
  • 36
  • Can you please provide me some references about this or maybe an example? Thank you so much! – Daniel_J Nov 22 '12 at 19:03
  • Please refer this: http://stackoverflow.com/questions/10223186/c-cli-wrapper-for-native-c-to-use-as-reference-in-c-sharp . For C++CLI: http://www.functionx.com/cppcli/index.htm . – Matt Nov 23 '12 at 02:09