How to make function call from VB.Net to C++/CLI DLL (Both areVS2005)

  • Thread starter Thread starter lia.leon
  • Start date Start date
L

lia.leon

Can anyone give me a simple example to demonstrate the captioned
question?

Actually, instead of PInvoke, we'd like to utilize the united .Net
platform to support our requirement:-
VB.Net sends a structure (includes 3-dimensional array) to C++/CLI
Dll, and the C++/CLI Dll will return a structure (includes 2-
dimensional array) back to VB.Net for future handling
 
Just use C++/CLI to create an assembly referenced by the VB app.

The C++/CLI syntax for a value type with a 2-dimensional array of integers is:
public value class Foo //or you can use 'value struct'
{
public:
array<int, 2> ^myArray = gcnew array<int, 2>();
.... <other members> ....
};

The only difference between 'value class' and 'value struct' is that the
default access is private for 'value class'. If it's a reference type you
want, use 'ref class' or 'ref struct'.

Similarly, the syntax for a 3-dimensional array of integers is:
array<int, 3> ^myArray = gcnew array<int, 3>();

If its actually jagged arrays that you want instead of true 'rectangular'
multi-dimensional arrays, then the syntax is:
array<array<int>>
array<array<array<int>>>
etc.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
VB & C# to Java
Java to VB & C#
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB, C#, or Java to C++/CLI
 
Back
Top