Comments (8)
see focumetation for obj-c runtime here: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
from pyobjus.
nice start :)
from pyobjus.
using NSBundle, we can load frameworks at runtime (not sure if possible on iOS), but otherwise, all frameworks have to be linked at compile time:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/Tasks/LoadingBundles.html#//apple_ref/doc/uid/20001273-CJBDDCAB
from pyobjus.
C code (needs to link against libobjc.dylib [and if getting e.g. NSWindow class, also AppKit.framework]):
#include <stdio.h>
#include "objc/runtime.h"
int main(int argc, const char * argv[])
{
Class _NSWindow = (Class)objc_getClass("NSWindow");
printf("getting class NSWindow");
unsigned int num_methods = 0;
Method* class_methods = class_copyMethodList(_NSWindow, &num_methods);
for(int i=0; i<num_methods; i++){
const char* name = sel_getName(method_getName(class_methods[i]));
const char* typeenc = method_getTypeEncoding(class_methods[i]);
printf("name: '%s', type_enc: %s\n", name, typeenc);
}
return 0;
}
from pyobjus.
objc/runtime.h:
https://gist.github.com/3362098
from pyobjus.
mhhh...C code in xcode runs OK, but trying to do it from cython the class registry seems to be empty:
http://www.stypi.com/hansent/simple.pyx compiles ok. since it's using objc_getRequiredClass it also errors, but problem is registry is not created with classes...not sure how to do it/what to load, tried copying all compiler args/linker args from Xcode c example...but still the same
from pyobjus.
dlopen() the foundation make the example works. fix commited
from pyobjus.
done!
from pyobjus.
Related Issues (20)
- How to pass bytes object into void* argument of a function? (NSData.dataWithBytes:length:) HOT 1
- Dependency Dashboard
- error when compiling Kivy on Xcode due to pyobjus HOT 1
- objc_arr will crash if empty array
- nameerror: name 'build_ext' is not defined during installation on linux HOT 6
- KeyError at field_list.append() HOT 1
- Error while installation: ERROR: The tar file (...) has a file (...) trying to install outside target directory (...) HOT 6
- Error installing Pyobjus. super() takes at least 1 argument (0 given) HOT 1
- When trying to install Pyobjus: NameError: name 'build_ext' is not defined HOT 1
- 'error: Unsupported architecture' when trying to install on Mac OS X Catalina 10.15.7 HOT 1
- autoclass('NSString', ... ) => 'TypeError: expected bytes, str found' HOT 2
- Wrong behaviour of NSArray on arm64 (but works on x86_64) HOT 3
- Suggestion: add ability add user defined @protocols HOT 1
- Wi-Fi Support HOT 1
- pyobjus installation error on Mac m1 HOT 1
- 'objc_msgSend_stret' is unavailable: not available in arm64 HOT 5
- AttributeError: 'bridge' object has no attribute 'startDeviceMotion'
- Malloc/heap corruption when passing a NSRect value from python to ObjectiveC
- [MacOs] Wheels provided for pyobjus are not universal HOT 2
- An example of iOS Mapkit would help! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyobjus.