Click to See Complete Forum and Search --> : Returning strings from C DLL


acroberts
August 2nd, 1999, 04:12 AM
I've become responsible for some old code which returns a newly allocated string to a VB app. We just switched over from Visual C++ 2.1 to Visual C++ 4.2. Apparently 4.2 no longer supports automatic conversion of strings, so we cannot allocate a BSTR properly and return it to the VB App.

My question is, what is the correct way to allocate and return a string to a VB app from a DLL, given a char*?

Cheers beers,

Ant.

Lothar Haensler
August 2nd, 1999, 06:28 AM
you need to call SysAllocString as documented in
MSDN article Q196976