I have a native Delphi exe which calls into C# dll via COM interop. Here\'s the simplest case which demonstrate this issue:
Delphi:
IClass1 = interfa
In Delphi, a null (i.e., nil
) and empty string are treated as equivalent. As such, passing ''
for a string (or WideString
) parameter passes nil
internally -
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
procedure Foo(const S: WideString);
begin
WriteLn(Pointer(S) = nil);
end;
begin
Foo('Something'); //FALSE
Foo(''); //TRUE
ReadLn;
end.
The equation of null and empty strings was in fact copied from COM... so a COM library isn't really the place to insist on a C#-style distinction between the two.