daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Jan 15th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top