Advertisement
emacstheviking

Untitled

Nov 8th, 2020
1,732
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
J 0.42 KB | None | 0 0
  1. //---- exploring FFI: how to pass in a struct and have it modified?
  2. int write_test(int start, int count, char* buf) {
  3.     int i=0;
  4.     for(i=0; i<count; i++) {
  5.         *(buf+i) = 0x41+i; // A, B, C...
  6.     }
  7.     return 42;
  8. }
  9.    './mylib.dylib write_test i i i *' cd 0;10;(10#' ')
  10. ┌──┬─┬──┬──────────┐
  11. 42010│ABCDEFGHIJ│
  12. └──┴─┴──┴──────────┘
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement