-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objective-C support #142
Comments
I don't know -- I've never used Objective-C. If its tooling is close to C/C++'s it would probably be pretty easy. |
Yeah the tooling is close afaik. As a clang user I just compile a Trying to look on |
Ok I still don't know exactly how the internals work but I got it working! Just changing Then I can do cglCtx <- [C.block| void* {
NSOpenGLContext* object = (NSOpenGLContext*) $(void* nsglCtx);
return [object CGLContextObj];
}|] Instead of cglCtx <- [C.block| void* {
id object = (id) $(void* nsglCtx);
SEL selector = sel_registerName("CGLContextObj");
Method method = class_getInstanceMethod(object_getClass(object), selector);
IMP imp = method_getImplementation(method);
return ((CGLContextObj (*)(id, SEL))imp)(object, selector);
}|] How would we like it do work? In a separate module/package like C++? If you have a general design for how this should work then I can make a PR for it. |
The right way to do this is in a separate package following the pattern of
inline-c-cpp.
…On Wed, 10 May 2023 at 15:24, Yair Chuchem ***@***.***> wrote:
Ok I still don't know exactly how the internals work but I got it working!
Just changing TH.LangC to TH.LangObjc in initialiseModuleState makes
Objective-C work.
Then I can do
cglCtx <- [C.block| void* {
NSOpenGLContext* object = (NSOpenGLContext*) $(void* nsglCtx);
return [object CGLContextObj];
}|]
Instead of
cglCtx <- [C.block| void* {
id object = (id) $(void* nsglCtx);
SEL selector = sel_registerName("CGLContextObj");
Method method = class_getInstanceMethod(object_getClass(object), selector);
IMP imp = method_getImplementation(method);
return ((CGLContextObj (*)(id, SEL))imp)(object, selector);
}|]
How would we like it do work? In a separate module/package like C++? If
you have a general design for how this should work then I can make a PR for
it.
—
Reply to this email directly, view it on GitHub
<#142 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHYOSXBBPOKYJ3YFQY7H3XFOQIPANCNFSM6AAAAAAX4R34EU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Fixed by #143 . |
What would it take to support Objective-C too?
The text was updated successfully, but these errors were encountered: