Click here to Skip to main content
12,823,984 members (44,038 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ VB VB.NET
I have written in C++ a .NET class library which serves as a wrapper over an existing C++ API.

Some of the arguments are pointers (byte*) that allow the user to pass his own raw buffers as arguments.

All works fine as long as the library is referenced under C++ and C#. On the opposite, VB does not recognize the functions that use such arguments. They don't even appear in the Object Browser.

I am not really looking for a safe solution, just a workaround.

Any suggestion?
Posted 31-May-12 0:22am
Updated 31-May-12 5:35am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Not really familiar with VB, but the IntPtr[^] class should allow you to interact with pointers. You might want to overload the C++ functions to accept those as well (if I understand correctly, and the C++ is C++/CLI).

And worse case, if you can get it to work in C#, write a C# wrapper for the C++ functions that are giving you trouble.
YvesDaoust 31-May-12 11:38am
Interesting proposal.

I am trying that, it works on a property and a method argument ! Thanks !
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

VB.Net does not have pointer types, but it does support pointers as method parameters. You didn't post your VB code, but at a guesss, your declarations are using the ByVal keyword for all parameters; try using ByRef for the pointers. That tells the Framework to treat the parameters as reference pointers, which should do what you need.
YvesDaoust 31-May-12 10:30am
The class library is written in C++. The buffer arguments are typed as unsigned char* (unmanaged). I am not writing the VB declarations myself, the Object Browser does.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 31 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100