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

How to setup delegate to return byte[] ? #11

Open
ghost opened this issue Jun 4, 2018 · 1 comment
Open

How to setup delegate to return byte[] ? #11

ghost opened this issue Jun 4, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 4, 2018

Thank you very much for your excellent package.
But as I don't know C, I face the following problem:
There are typedefs in test.go for C# methods with signatures int A(int, int) and string S(). That's OK.
But I need to return array of bytes (byte[]) from my C# method and consume it from Go function.
What C# method signature and corresponding typedef to use ?
To return slice of bytes from Go function with the help of C.GoBytes I need unsafe.Pointer and C.int. How to obtain these ?
Could you provide an example ?

@matiasinsaurralde
Copy link
Owner

Hi @POSOlSoft, that's interesting, I haven't reached that yet. I wrote this quick test to handle char* to Go string conversions: https://github.com/matiasinsaurralde/go-dotnet/blob/master/dotnet/test.go#L48-L54
Passing an array of []byte is more complex, I would focus on that asap, I'm currently refactoring the code generation tool and trying to fix Windows support. Will keep this issue open in case I have any updates.

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