Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
Updated 31-May-12 4:35am
v3

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.
 
Share this answer
 
Comments
YvesDaoust 31-May-12 11:38am    
Interesting proposal.

I am trying that, it works on a property and a method argument ! Thanks !
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.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900