LegacyWrapper icon indicating copy to clipboard operation
LegacyWrapper copied to clipboard

Int32 GetStr( out String Str) no string out

Open Arvidas opened this issue 6 years ago • 3 comments

Int32 GetStr( out String Str); Not working, hangs or no Str change.

original: //[DllImport("x32.dll", // CallingConvention = CallingConvention.StdCall, // CharSet = CharSet.Unicode, // EntryPoint = "GetStr")] //public static extern Int32 GetStr( // [MarshalAs(UnmanagedType.BStr)] out String Str // );

Arvidas avatar Feb 22 '19 09:02 Arvidas

Can you provide your interface definition and the calling code?

zalintyre avatar Feb 22 '19 18:02 zalintyre

    [LegacyDllImport("x32.dll")]
    public interface IGetStr : IDisposable
    {
        [LegacyDllMethod(CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
        Int32 GetStr( out String Str);
    }

 public static Int32 GetStr(ref String str)
{
  return = client.GetStr(out s);
}

String s = ""
GetStr(ref s);

if ( s != "") Ok();

Arvidas avatar Feb 25 '19 16:02 Arvidas

I am running into a very similar problem, which I logged as "How to call a ref string function?" at https://github.com/CodefoundryDE/LegacyWrapper/issues/18

wdstest avatar May 03 '19 16:05 wdstest