sumankhanal

nativecall-raku-c++2

Jun 12th, 2020
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. # this is test.cpp file
  2.  
  3. #include <algorithm>
  4. #include <iostream>
  5. #include <string>
  6.  
  7. extern "C" int count(std::string String)
  8. {
  9.     return std::count(String.begin(), String.end(), 'a');
  10. }
  11.  
  12. # this is test.raku
  13.  
  14. use NativeCall;
  15. sub count(Str $str is encoded('utf8')) returns int32 is native('libtest') { * };
  16.  
  17. say count("pastepaste")
Add Comment
Please, Sign In to add comment