0

I have a problem when I try to map char* to String, Pointer or ByteBuff.

We had declared a function in C, show as below

long A_Connect(OUT char* x);

In fact the variable x will get a value after we execute this function.

but when I try to get the value from JAVA, it just get a null string, I had try different java function like:

NativeLong A_Connect(String x);

NativeLong A_Connect(Pointer x);

NativeLong A_Connect(byte[] x);

I will appreciate it if anyone can help us with this problem.enter code here

A. Xiao
  • 1
  • 1
  • https://stackoverflow.com/questions/2806545/does-java-have-something-like-cs-ref-and-out-keywords This is about C# and not C, but same idea. – Guy Sep 11 '19 at 05:39
  • How do you know how many characters are in the String? Who is allocating memory for it? Try allocating memory (not sure how much) with `new Memory(12345)` and pass that Memory buffer as the argument, the use `getString()` on the returned value. – Daniel Widdis Sep 11 '19 at 06:23

0 Answers0