Click here to Skip to main content
Sign Up to vote bad
good
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 30 May '12 - 23:22
Edited 31 May '12 - 4:35


2 solutions

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.
  Permalink  
Comments
YvesDaoust - 31 May '12 - 11:38
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.
  Permalink  
Comments
YvesDaoust - 31 May '12 - 10:30
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 425
1 OriginalGriff 315
2 Slacker007 240
3 Aarti Meswania 210
4 Maciej Los 200
0 Sergey Alexandrovich Kryukov 8,953
1 OriginalGriff 7,134
2 CPallini 3,758
3 Rohan Leuva 3,036
4 Maciej Los 2,488


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 31 May 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid