Guest User

Untitled

a guest
Jan 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. public class TTM {
  2.  
  3. public interface WrapperDLL extends Library {
  4. WrapperDLL INSTANCE = (WrapperDLL) Native.loadLibrary("TransportRE", WrapperDLL.class);
  5.  
  6. int TRE_send(int channel, Pointer data, int len);
  7.  
  8. }
  9. public int Send (int channel, String data, int len) {
  10. WrapperDLL wdll = WrapperDLL.INSTANCE;
  11.  
  12. Memory mem = new Memory(data.length()+1);
  13. mem.setString(0, data);
  14. int byteSent = wdll.TRE_send(channel_id, mem.getPointer(0), len);
  15. // at this (TRE_send) point the VM crashes !!!!
  16.  
  17. return byteSent;
  18. }
  19.  
  20. public int Send (int channel, String data, int len) {
  21. WrapperDLL wdll = WrapperDLL.INSTANCE;
  22.  
  23. Memory mem = new Memory(data.length()+1);
  24. mem.setString(0, data);
  25. int byteSent = wdll.TRE_send(channel_id, mem, len);
  26.  
  27. return byteSent;
  28. }
  29.  
  30. void send(String);
  31. void send(Pointer);
  32. void send(MyStructure);
  33.  
  34. int byteSent = wdll.TRE_send(channel_id, data.toCharArray(), len);
Add Comment
Please, Sign In to add comment