Calling C++ functions from VB with pointer parameters

R

Richards

I have a .NET solution with a VB project and a C++ project.

The C++ project has namespace and public class with assorted functions.

I add the C++ project as a reference in the VB project.

When I look at Object Browser for the above reference, any C++ function in
the public class with a pointer in the argument list is omitted.

For example:

The following will appear in the object browser and can be referenced in the
VB program:
int TheNameSpace::TheClass::TheFunction(long length, long data )

However, the following DOES NOT appear in the object browser and CAN NOT be
referenced in the VB program:
int TheNameSpace::TheClass::TheFunction(long length, long * data )

No build warnings or errors are given in the latter case.

HELP PLEASE!
 
R

Richards via DotNetMonster.com

Dear Colleages,

I have a solution to this problem:

The declaration of the pointer paramenter in the C++ function needs the __gc
qualifier. With this, the function becomes visible in the VB application
object browser with the parameter shown as "ByRef"'.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top