Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

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

Reply
 
Old 07-30-2008   #1 (permalink)
lia.leon


 
 

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

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


My System SpecsSystem Spec
Old 07-30-2008   #2 (permalink)
David Anton


 
 

RE: How to make function call from VB.Net to C++/CLI DLL (Both are VS2

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


"lia.leon@xxxxxx" wrote:
Quote:

> 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
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Can't make a pc to pc call. (using WLM) Can someone help? Live Messenger
Call SPlus function from C#.NET language .NET General
Call function with parameters that also call functions (.Net and P PowerShell
Call depth reached when calling function PowerShell
function call from within powershell script PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46