Advertisement
adilima

Simple C++ test for accessing libobjc

Jan 14th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. typedef struct objc_class {
  5.     struct objc_class *isa;
  6. } *Class;
  7.  
  8. extern "C" Class objc_getClass(const char* pszName);
  9. extern "C" const char* class_getName(Class cls);
  10.  
  11. int main(int argc, char** argv)
  12. {
  13.     Class pClass = objc_getClass("Object");
  14.     if (pClass)
  15.     {
  16.         std::cout << "Got a class \"" << class_getName(pClass)
  17.             << "\" (" << (void*)pClass << ")\n";
  18.     }
  19.     else
  20.         std::cerr << "Unable to get a class named \"Object\", aborting...\n";
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement