Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Int32 GetStr( out String Str) no string out #17

Open
Arvidas opened this issue Feb 22, 2019 · 3 comments · May be fixed by #34
Open

Int32 GetStr( out String Str) no string out #17

Arvidas opened this issue Feb 22, 2019 · 3 comments · May be fixed by #34

Comments

@Arvidas
Copy link

Arvidas commented Feb 22, 2019

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
// );

@zalintyre
Copy link
Contributor

Can you provide your interface definition and the calling code?

@Arvidas
Copy link
Author

Arvidas commented Feb 25, 2019

    [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();

@wdstest
Copy link

wdstest commented May 3, 2019

I am running into a very similar problem, which I logged as "How to call a ref string function?" at #18

@zalintyre zalintyre linked a pull request Oct 27, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants