Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is OleVariant usable for out parameter in DLL proc?

I want to make an interface, but I don't know something.

Is OleVariant a "standard" for containing "standard" string - to pass and return?

function Any(Input : OleVariant; out Output : OleVariant) : integer; stdcall;

The another side is maybe .NET, C#, or C++ or Delphi.

So can they back some "string" result in OleVariant without I pass a predefined sized buffer for result?

like image 306
durumdara Avatar asked Dec 08 '11 13:12

durumdara


1 Answers

Yes, OleVariant is perfectly safe. You'll see it used throughout the COM-related units distributed with Delphi, such as ActiveX, ComSvcs, and MSXML. Standard Windows API units use it, so you can, too.

If you're always expecting a string, though, then you should prefer WideString instead. It's equivalent to the Windows BSTR type.

like image 185
Rob Kennedy Avatar answered Nov 19 '22 01:11

Rob Kennedy