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

MarshalDirectiveException : Method's type signature is not PInvoke compatible. #2

Open
jrouaix opened this issue May 18, 2020 · 1 comment

Comments

@jrouaix
Copy link
Owner

jrouaix commented May 18, 2020

Well, i'm having troubles with FFI on netcoreapp2 vs all good on netcoreapp3

image

[DllImport(LIB_NAME, CharSet = CharSet.Ansi)]
public static extern FFIExecResult ffi_exec_expr(FFIExpressionHandle ptr, FFIIdentifierKeyValue[] identifier_values, UIntPtr identifier_values_len);

I narrowed the problem to the function return type :

[StructLayout(LayoutKind.Sequential)]
internal unsafe struct FFIExecResult
{
    [MarshalAs(UnmanagedType.I1)]
    public bool is_error;
    public IntPtr content;

    public FFIStringHandle GetContent() => new FFIStringHandle(content);
}

Is there some other way to hack through this on netcore2 ?

@jrouaix
Copy link
Owner Author

jrouaix commented May 18, 2020

Source here :

[StructLayout(LayoutKind.Sequential)]
internal unsafe struct FFIExecResult
{
[MarshalAs(UnmanagedType.I1)]
public bool is_error;
//[MarshalAs(UnmanagedType.SysInt)]
public IntPtr content;
public FFIStringHandle GetContent() => new FFIStringHandle(content);
}

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

No branches or pull requests

1 participant