Question: Is there any example of calling a golang function with a String argument and getting a String result back? #224
Replies: 4 comments 1 reply
-
I am not familiar with how Go exports functions for C-like consumers. That would be my first question: is the function being exported from the library in a C-compatible way? If you can turn this into a small repository that I can build and run I may be able to help you better. |
Beta Was this translation helpful? Give feedback.
-
@headius That's the problem I tried to raise with this issue, because I don't have an example, I don't know how to go about giving you an example. |
Beta Was this translation helpful? Give feedback.
-
@lestephane I was just hoping you might put together a small repository that has these files and builds them so I can at least get the same native Go binary that you are trying to use. Your interface and loader code are clearly not just Java... I think they are Scala code? Really I just need to see an example project that builds these pieces and then I can try to help you make it work the way you expect. |
Beta Was this translation helpful? Give feedback.
-
I have moved this issue to a discussion. |
Beta Was this translation helpful? Give feedback.
-
After having found a reference to this project in this blog post, I've been trying to talk to a GO compiled shared library using 'simple' strings, but I'm getting
java.lang.UnsatisfiedLinkError: unknown
, and I don't know how to turn on more debugging information.Java Interface
Go file compiled with
-buildmode=c-shared
to alibhello-linux-amd64.so
fileLoader class
When I call the loader
I get the error trace
Am I trying to do something that is simply not possible? If someone has managed to pass a string back and forth between java and GO using jnr-ffi, I'd love to get a working example. This is with Go 1.15.8.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions