Currently I'm rewriting an application for Win32. I just lost all of the source so I'm forced to re-write the code. This is a joint effort with another programmer, but he is using VB 6. I have a copy of this and have been studying VB quite a bit recently.

My question is: How do I send a string from VB to C++ without using some third party software?

I realize that I could just take the segment and offset of the string in VB and send that to the C++ function that operates on the string. I could use the string by using an offset into the string from the starting offset. However, this all feels quite clunky and very abstract.

If we declare the variable to be of type Variant and pass BYREF to the C++ function, will we get the string we want or will we get garbage. How should we code the C++ function to receive the string from VB? Since VisualBasic deals with strings a bit different than C++, this is posing quite a problem.

I realize that there are third party software vendors that allow multi-language projects to communicate with each other, but we would like to avoid the obvious overhead involved in such a program.