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

Passing Arrays & Object between Java and C# #187

Closed
namhvcntt opened this issue Mar 28, 2021 · 1 comment
Closed

Passing Arrays & Object between Java and C# #187

namhvcntt opened this issue Mar 28, 2021 · 1 comment

Comments

@namhvcntt
Copy link

I'm trying to pass data between Java and C#, it works with primitive data types but not work with Array and Object. I watched 2 demos but they are not mentioned how to pass array and object.
Can you help me to provide some instructions? Thanks.

Here is my some code
C# code

{
        [DllExport]
        public static String[] getAvailablePorts() {
            return System.IO.Ports.SerialPort.GetPortNames();
        }
}

Java & JNA code

public class Demo{
    static {
        Native.register("<path_to_dll>");
    }
    public native static String[] getAvailablePorts();
}

@3F
Copy link
Owner

3F commented Mar 28, 2021

Duplicate of #30

I watched 2 demos but they are not mentioned how to pass array and object.

I think it was mentioned if you're talking about screencasts

https://github.com/3F/DllExport/wiki/Examples-Part-2

08:42 - Passing arrays from unmanaged C++ ((host side)) to C#.
12:27 - Passing multidimensional arrays from C++ ((host side)) to C#.
22:47 - Passing arrays to C# from Java ((host side)).

structures

05:21 - Passing complex types from C# to unmanaged C++ ((host side)). Samples for structures.
16:23 - Passing complex types from C++ to C# ((host side)). Samples for structures.

in advance, my note about dotnet classes

@3F 3F closed this as completed Mar 28, 2021
@3F 3F added the duplicate label Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants